Re: [PATCH 2/2] usb: storage: ene_ub6250: fix compile warnings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Nov 10, 2011 at 10:47:13AM +0200, Felipe Balbi wrote:
> Fix the following compile warning:
> 
> | drivers/usb/storage/ene_ub6250.c: In function ‘ms_scsi_write’:
> | drivers/usb/storage/ene_ub6250.c:1728:6: warning: ‘result’ may \
> |	be used uninitialized in this function [-Wuninitialized]
> | drivers/usb/storage/ene_ub6250.c:1795:77: warning: ‘offset’ may \
> |	be used uninitialized in this function [-Wuninitialized]
> 
> Signed-off-by: Felipe Balbi <balbi@xxxxxx>
> ---
>  drivers/usb/storage/ene_ub6250.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/storage/ene_ub6250.c b/drivers/usb/storage/ene_ub6250.c
> index 4dca3ef..765406c 100644
> --- a/drivers/usb/storage/ene_ub6250.c
> +++ b/drivers/usb/storage/ene_ub6250.c
> @@ -1725,7 +1725,7 @@ exit:
>  
>  static int ms_scsi_write(struct us_data *us, struct scsi_cmnd *srb)
>  {
> -	int result;
> +	int result = 0;
>  	struct bulk_cb_wrap *bcb = (struct bulk_cb_wrap *) us->iobuf;
>  	unsigned char *cdb = srb->cmnd;
>  	struct ene_ub6250_info *info = (struct ene_ub6250_info *) us->extra;

No, the correct thing to do here is:

> @@ -1762,7 +1762,7 @@ static int ms_scsi_write(struct us_data *us, struct scsi_cmnd *srb)
>  		result = ene_send_scsi_cmd(us, FDIR_WRITE, scsi_sglist(srb), 1);
>  	} else {
>  		void *buf;
> -		int offset;
> +		int offset = 0;
>  		u16 PhyBlockAddr;
>  		u8 PageNum;
>  		u32 result;

Delete this variable called "result", right?

The offset=0 is correct though, I'm guessing this code path never was
tested at all :(

Care to fix this up and resend?

thanks,

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


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux