[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux-usb
Subject:    Re: + drivers-usb-serial-ti_usb_3410_5052c-fix-uninitialied-var-warning.patch added to -mm tree
From:       Oliver Neukum <oliver () neukum ! org>
Date:       2009-06-30 7:13:23
Message-ID: 200906300913.23739.oliver () neukum ! org
[Download RAW message or body]

Am Dienstag, 30. Juni 2009 02:08:16 schrieb akpm@linux-foundation.org:

> @@ -1658,7 +1658,6 @@ static int ti_do_download(struct usb_dev
>  	u8 cs = 0;
>  	int done;
>  	struct ti_firmware_header *header;
> -	int status;
>  	int len;
>
>  	for (pos = sizeof(struct ti_firmware_header); pos < size; pos++)
> @@ -1671,13 +1670,15 @@ static int ti_do_download(struct usb_dev
>
>  	dbg("%s - downloading firmware", __func__);
>  	for (pos = 0; pos < size; pos += done) {
> +		int status;
> +
>  		len = min(size - pos, TI_DOWNLOAD_MAX_PACKET_SIZE);
>  		status = usb_bulk_msg(dev, pipe, buffer + pos, len,
>  								&done, 1000);
>  		if (status)
> -			break;
> +			return status;

This kind of fix doesn't seem to be a good idea. You always run the risk
that somebody wants to add error handling or locking and will have problems.
Can't you just initialize the variable and be done with it instead of this ugly
per block which always causes potential problems with overshadowing?

	Regards
		Oliver

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic