Patchwork brcmsmac: initialize morepending in brcms_b_recv()

login
register
mail settings
Submitter Geert Uytterhoeven
Date Dec. 22, 2012, 9:07 p.m.
Message ID <1356210434-28435-1-git-send-email-geert@linux-m68k.org>
Download mbox | patch
Permalink /patch/207940/
State Not Applicable
Delegated to: David Miller
Headers show

Comments

Geert Uytterhoeven - Dec. 22, 2012, 9:07 p.m.
drivers/net/wireless/brcm80211/brcmsmac/main.c: In function ‘brcms_b_recv’:
drivers/net/wireless/brcm80211/brcmsmac/main.c:7636: warning: ‘morepending’ may be used uninitialized in this function

Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
---
 drivers/net/wireless/brcm80211/brcmsmac/main.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Arend van Spriel - Dec. 23, 2012, 5:31 p.m.
On 12/22/2012 10:07 PM, Geert Uytterhoeven wrote:
> drivers/net/wireless/brcm80211/brcmsmac/main.c: In function ‘brcms_b_recv’:
> drivers/net/wireless/brcm80211/brcmsmac/main.c:7636: warning: ‘morepending’ may be used uninitialized in this function
> 

Reading the code this warning seems to be invalid except when RXBND is
defined as zero, which would make the whole function totally bogus.
Would be good to have a WARN_ON(!RXBND) in brcms_b_attach().

I don't like pleasing a compiler with unnecessary initializers but I am
also for builds with zero warnings. So...

Acked-by: Arend van Spriel <arend@broadcom.com>
> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
> ---
>  drivers/net/wireless/brcm80211/brcmsmac/main.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/net/wireless/brcm80211/brcmsmac/main.c b/drivers/net/wireless/brcm80211/brcmsmac/main.c
> index 17594de..5f0f444 100644
> --- a/drivers/net/wireless/brcm80211/brcmsmac/main.c
> +++ b/drivers/net/wireless/brcm80211/brcmsmac/main.c
> @@ -7633,7 +7633,7 @@ brcms_b_recv(struct brcms_hardware *wlc_hw, uint fifo, bool bound)
>  
>  	uint n = 0;
>  	uint bound_limit = bound ? RXBND : -1;
> -	bool morepending;
> +	bool morepending = false;
>  
>  	skb_queue_head_init(&recv_frames);
>  


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Geert Uytterhoeven - Dec. 24, 2012, 12:02 p.m.
On Sun, Dec 23, 2012 at 6:31 PM, Arend van Spriel <arend@broadcom.com> wrote:
> On 12/22/2012 10:07 PM, Geert Uytterhoeven wrote:
>> drivers/net/wireless/brcm80211/brcmsmac/main.c: In function ‘brcms_b_recv’:
>> drivers/net/wireless/brcm80211/brcmsmac/main.c:7636: warning: ‘morepending’ may be used uninitialized in this function
>
> Reading the code this warning seems to be invalid except when RXBND is
> defined as zero, which would make the whole function totally bogus.
> Would be good to have a WARN_ON(!RXBND) in brcms_b_attach().

I thought about the bound = false case immediately ending the loop.
But on closer look, it seems I missed that n and bound_limit are uint, not int.
So it's indeed unlikely to happen.

> I don't like pleasing a compiler with unnecessary initializers but I am
> also for builds with zero warnings. So...
>
> Acked-by: Arend van Spriel <arend@broadcom.com>
>> Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
>> ---
>>  drivers/net/wireless/brcm80211/brcmsmac/main.c |    2 +-
>>  1 files changed, 1 insertions(+), 1 deletions(-)
>>
>> diff --git a/drivers/net/wireless/brcm80211/brcmsmac/main.c b/drivers/net/wireless/brcm80211/brcmsmac/main.c
>> index 17594de..5f0f444 100644
>> --- a/drivers/net/wireless/brcm80211/brcmsmac/main.c
>> +++ b/drivers/net/wireless/brcm80211/brcmsmac/main.c
>> @@ -7633,7 +7633,7 @@ brcms_b_recv(struct brcms_hardware *wlc_hw, uint fifo, bool bound)
>>
>>       uint n = 0;
>>       uint bound_limit = bound ? RXBND : -1;
>> -     bool morepending;
>> +     bool morepending = false;
>>
>>       skb_queue_head_init(&recv_frames);

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/drivers/net/wireless/brcm80211/brcmsmac/main.c b/drivers/net/wireless/brcm80211/brcmsmac/main.c
index 17594de..5f0f444 100644
--- a/drivers/net/wireless/brcm80211/brcmsmac/main.c
+++ b/drivers/net/wireless/brcm80211/brcmsmac/main.c
@@ -7633,7 +7633,7 @@  brcms_b_recv(struct brcms_hardware *wlc_hw, uint fifo, bool bound)
 
 	uint n = 0;
 	uint bound_limit = bound ? RXBND : -1;
-	bool morepending;
+	bool morepending = false;
 
 	skb_queue_head_init(&recv_frames);