linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Larry Finger <Larry.Finger@lwfinger.net>
To: "John W. Linville" <linville@tuxdriver.com>
Cc: linux-wireless@vger.kernel.org, Chaoming Li <chaoming_li@realsil.com.cn>
Subject: Re: [PATCH] rtlwifi: squash warning in _usb_read_sync
Date: Mon, 21 Nov 2011 18:05:56 -0600	[thread overview]
Message-ID: <4ECAE764.4000407@lwfinger.net> (raw)
In-Reply-To: <1321911446-11564-1-git-send-email-linville@tuxdriver.com>

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));


      reply	other threads:[~2011-11-22  0:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-21 21:37 [PATCH] rtlwifi: squash warning in _usb_read_sync John W. Linville
2011-11-22  0:05 ` Larry Finger [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4ECAE764.4000407@lwfinger.net \
    --to=larry.finger@lwfinger.net \
    --cc=chaoming_li@realsil.com.cn \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).