[U-Boot] [PATCH] cmd/usb_mass_storage.c: Rework ums_init() ret logic slightly

Tom Rini trini at konsulko.com
Wed Apr 20 19:20:39 CEST 2016


On Wed, Apr 20, 2016 at 05:46:53PM +0200, Marek Vasut wrote:
> On 04/20/2016 05:01 PM, Tom Rini wrote:
> > Previously, ret could be used uninitialized if
> > blk_get_device_part_str() failed.  Default to ret being set to -1 so
> > that we always return an err up if we have a problem and then invert the
> > logic on testing ums_count as when that is non-zero is the time we can
> > return 0.
> > 
> > Cc: John Tobias <john.tobias.ph at gmail.com>
> > Cc: Marek Vasut <marex at denx.de>
> > Signed-off-by: Tom Rini <trini at konsulko.com>
> > ---
> >  cmd/usb_mass_storage.c | 9 ++-------
> >  1 file changed, 2 insertions(+), 7 deletions(-)
> > 
> > diff --git a/cmd/usb_mass_storage.c b/cmd/usb_mass_storage.c
> > index ac53a73..b03d567 100644
> > --- a/cmd/usb_mass_storage.c
> > +++ b/cmd/usb_mass_storage.c
> > @@ -56,7 +56,7 @@ static int ums_init(const char *devtype, const char *devnums_part_str)
> >  	struct blk_desc *block_dev;
> >  	disk_partition_t info;
> >  	int partnum;
> > -	int ret;
> > +	int ret = -1;
> >  	struct ums *ums_new;
> >  
> >  	s = strdup(devnums_part_str);
> > @@ -86,13 +86,11 @@ static int ums_init(const char *devtype, const char *devnums_part_str)
> >  
> >  		/* f_mass_storage.c assumes SECTOR_SIZE sectors */
> >  		if (block_dev->blksz != SECTOR_SIZE) {
> 
> You can also drop the {} braces now.
> 
> Otherwise,
> 
> Acked-by: Marek Vasut <marex at denx.de>

I'll fix 'em up, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160420/bd15bfbf/attachment-0001.sig>


More information about the U-Boot mailing list