diff mbox series

brcmfmac: fix false-positive -Wmaybe-unintialized warning

Message ID 20181210205555.3000038-1-arnd@arndb.de (mailing list archive)
State Accepted
Commit 412dd15c8177d93abe0c8787b83b31c5eb061405
Delegated to: Kalle Valo
Headers show
Series brcmfmac: fix false-positive -Wmaybe-unintialized warning | expand

Commit Message

Arnd Bergmann Dec. 10, 2018, 8:55 p.m. UTC
When CONFIG_NO_AUTO_INLINE is set, we get a false-postive warning
for the brcmf_fw_request_nvram_done() function, after gcc figures
out that brcmf_fw_nvram_from_efi() might not set the 'data_len'
variable, but fails to notice that it always returns NULL:

drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c: In function 'brcmf_fw_request_nvram_done':
drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c:560:11: error: 'data_len' may be used uninitialized in this function [-Werror=maybe-uninitialized]

Mark it 'inline' to force gcc to understand this.

Fixes: ce2e6db554fa ("brcmfmac: Add support for getting nvram contents from EFI variables")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Hans de Goede Dec. 11, 2018, 1:04 p.m. UTC | #1
Hi,

On 10-12-18 21:55, Arnd Bergmann wrote:
> When CONFIG_NO_AUTO_INLINE is set, we get a false-postive warning
> for the brcmf_fw_request_nvram_done() function, after gcc figures
> out that brcmf_fw_nvram_from_efi() might not set the 'data_len'
> variable, but fails to notice that it always returns NULL:
> 
> drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c: In function 'brcmf_fw_request_nvram_done':
> drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c:560:11: error: 'data_len' may be used uninitialized in this function [-Werror=maybe-uninitialized]
> 
> Mark it 'inline' to force gcc to understand this.
> 
> Fixes: ce2e6db554fa ("brcmfmac: Add support for getting nvram contents from EFI variables")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Thanks, patch looks good to me:

Reviewed-by: Hans de Goede <hdegoede@redhat.com>

Regards,

Hans



> ---
>   drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
> index dad3c1c79038..14b948917a1a 100644
> --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
> +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
> @@ -512,7 +512,7 @@ static u8 *brcmf_fw_nvram_from_efi(size_t *data_len_ret)
>   	return NULL;
>   }
>   #else
> -static u8 *brcmf_fw_nvram_from_efi(size_t *data_len) { return NULL; }
> +static inline u8 *brcmf_fw_nvram_from_efi(size_t *data_len) { return NULL; }
>   #endif
>   
>   static void brcmf_fw_free_request(struct brcmf_fw_request *req)
>
Kalle Valo Dec. 13, 2018, 2:52 p.m. UTC | #2
Arnd Bergmann <arnd@arndb.de> wrote:

> When CONFIG_NO_AUTO_INLINE is set, we get a false-postive warning
> for the brcmf_fw_request_nvram_done() function, after gcc figures
> out that brcmf_fw_nvram_from_efi() might not set the 'data_len'
> variable, but fails to notice that it always returns NULL:
> 
> drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c: In function 'brcmf_fw_request_nvram_done':
> drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c:560:11: error: 'data_len' may be used uninitialized in this function [-Werror=maybe-uninitialized]
> 
> Mark it 'inline' to force gcc to understand this.
> 
> Fixes: ce2e6db554fa ("brcmfmac: Add support for getting nvram contents from EFI variables")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Reviewed-by: Hans de Goede <hdegoede@redhat.com>

Commit ce2e6db554fa is in w-d-next so this should go to that tree as well.
Kalle Valo Dec. 13, 2018, 2:59 p.m. UTC | #3
Arnd Bergmann <arnd@arndb.de> wrote:

> When CONFIG_NO_AUTO_INLINE is set, we get a false-postive warning
> for the brcmf_fw_request_nvram_done() function, after gcc figures
> out that brcmf_fw_nvram_from_efi() might not set the 'data_len'
> variable, but fails to notice that it always returns NULL:
> 
> drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c: In function 'brcmf_fw_request_nvram_done':
> drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c:560:11: error: 'data_len' may be used uninitialized in this function [-Werror=maybe-uninitialized]
> 
> Mark it 'inline' to force gcc to understand this.
> 
> Fixes: ce2e6db554fa ("brcmfmac: Add support for getting nvram contents from EFI variables")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Reviewed-by: Hans de Goede <hdegoede@redhat.com>

Patch applied to wireless-drivers-next.git, thanks.

412dd15c8177 brcmfmac: fix false-positive -Wmaybe-unintialized warning
diff mbox series

Patch

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
index dad3c1c79038..14b948917a1a 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
@@ -512,7 +512,7 @@  static u8 *brcmf_fw_nvram_from_efi(size_t *data_len_ret)
 	return NULL;
 }
 #else
-static u8 *brcmf_fw_nvram_from_efi(size_t *data_len) { return NULL; }
+static inline u8 *brcmf_fw_nvram_from_efi(size_t *data_len) { return NULL; }
 #endif
 
 static void brcmf_fw_free_request(struct brcmf_fw_request *req)