linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] rtlwifi: squash warning in _usb_read_sync
@ 2011-11-21 21:37 John W. Linville
  2011-11-22  0:05 ` Larry Finger
  0 siblings, 1 reply; 2+ messages in thread
From: John W. Linville @ 2011-11-21 21:37 UTC (permalink / raw)
  To: linux-wireless; +Cc: Larry Finger, Chaoming Li, John W. Linville

drivers/net/wireless/rtlwifi/usb.c: In function ‘_usb_read_sync’:
drivers/net/wireless/rtlwifi/usb.c:102:6: warning: ‘status’ may be used uninitialized in this function
drivers/net/wireless/rtlwifi/usb.c:102:6: note: ‘status’ was declared here

My compiler is dumb, but better to eliminate the warning then to have
anyone waste time evaluating this again...

Signed-off-by: John W. Linville <linville@tuxdriver.com>
---
 drivers/net/wireless/rtlwifi/usb.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/rtlwifi/usb.c b/drivers/net/wireless/rtlwifi/usb.c
index 79889b8..20f4403 100644
--- a/drivers/net/wireless/rtlwifi/usb.c
+++ b/drivers/net/wireless/rtlwifi/usb.c
@@ -107,7 +107,7 @@ static int _usbctrl_vendorreq_sync_read(struct usb_device *udev, u8 request,
 	pipe = usb_rcvctrlpipe(udev, 0); /* read_in */
 	reqtype =  REALTEK_USB_VENQT_READ;
 
-	while (++vendorreq_times <= MAX_USBCTRL_VENDORREQ_TIMES) {
+	do {
 		status = usb_control_msg(udev, pipe, request, reqtype, value,
 					 index, pdata, len, 0); /*max. timeout*/
 		if (status < 0) {
@@ -118,7 +118,8 @@ static int _usbctrl_vendorreq_sync_read(struct usb_device *udev, u8 request,
 		} else {
 			break;
 		}
-	}
+	} while (++vendorreq_times < MAX_USBCTRL_VENDORREQ_TIMES);
+
 	if (status < 0 && count++ < 4)
 		pr_err("reg 0x%x, usbctrl_vendorreq TimeOut! status:0x%x value=0x%x\n",
 		       value, status, le32_to_cpu(*(u32 *)pdata));
-- 
1.7.4.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] rtlwifi: squash warning in _usb_read_sync
  2011-11-21 21:37 [PATCH] rtlwifi: squash warning in _usb_read_sync John W. Linville
@ 2011-11-22  0:05 ` Larry Finger
  0 siblings, 0 replies; 2+ messages in thread
From: Larry Finger @ 2011-11-22  0:05 UTC (permalink / raw)
  To: John W. Linville; +Cc: linux-wireless, Chaoming Li

On 11/21/2011 03:37 PM, John W. Linville wrote:
> drivers/net/wireless/rtlwifi/usb.c: In function ‘_usb_read_sync’:
> drivers/net/wireless/rtlwifi/usb.c:102:6: warning: ‘status’ may be used uninitialized in this function
> drivers/net/wireless/rtlwifi/usb.c:102:6: note: ‘status’ was declared here
>
> My compiler is dumb, but better to eliminate the warning then to have
> anyone waste time evaluating this again...
>
> Signed-off-by: John W. Linville<linville@tuxdriver.com>
> ---
>   drivers/net/wireless/rtlwifi/usb.c |    5 +++--
>   1 files changed, 3 insertions(+), 2 deletions(-)

I like this fix a lot better than initializing 'status' to zero.

ACKed-by: Larry Finger <Larry.Finger@lwfinger.net>


>
> diff --git a/drivers/net/wireless/rtlwifi/usb.c b/drivers/net/wireless/rtlwifi/usb.c
> index 79889b8..20f4403 100644
> --- a/drivers/net/wireless/rtlwifi/usb.c
> +++ b/drivers/net/wireless/rtlwifi/usb.c
> @@ -107,7 +107,7 @@ static int _usbctrl_vendorreq_sync_read(struct usb_device *udev, u8 request,
>   	pipe = usb_rcvctrlpipe(udev, 0); /* read_in */
>   	reqtype =  REALTEK_USB_VENQT_READ;
>
> -	while (++vendorreq_times<= MAX_USBCTRL_VENDORREQ_TIMES) {
> +	do {
>   		status = usb_control_msg(udev, pipe, request, reqtype, value,
>   					 index, pdata, len, 0); /*max. timeout*/
>   		if (status<  0) {
> @@ -118,7 +118,8 @@ static int _usbctrl_vendorreq_sync_read(struct usb_device *udev, u8 request,
>   		} else {
>   			break;
>   		}
> -	}
> +	} while (++vendorreq_times<  MAX_USBCTRL_VENDORREQ_TIMES);
> +
>   	if (status<  0&&  count++<  4)
>   		pr_err("reg 0x%x, usbctrl_vendorreq TimeOut! status:0x%x value=0x%x\n",
>   		       value, status, le32_to_cpu(*(u32 *)pdata));


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-11-22  0:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-21 21:37 [PATCH] rtlwifi: squash warning in _usb_read_sync John W. Linville
2011-11-22  0:05 ` Larry Finger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).