diff mbox series

brcmfmac: initialize variable

Message ID 20200913143522.20390-1-trix@redhat.com
State New
Headers show
Series brcmfmac: initialize variable | expand

Commit Message

Tom Rix Sept. 13, 2020, 2:35 p.m. UTC
From: Tom Rix <trix@redhat.com>

clang static analysis flags this problem
sdio.c:3265:13: warning: Branch condition evaluates to
  a garbage value
        } else if (pending) {
                   ^~~~~~~

brcmf_sdio_dcmd_resp_wait() only sets pending to true.
So pending needs to be initialized to false.

Fixes: 5b435de0d786 ("net: wireless: add brcm80211 drivers")
Signed-off-by: Tom Rix <trix@redhat.com>
---
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Arend van Spriel Sept. 14, 2020, 5:26 a.m. UTC | #1
On September 13, 2020 4:35:44 PM trix@redhat.com wrote:

> From: Tom Rix <trix@redhat.com>
>
> clang static analysis flags this problem
> sdio.c:3265:13: warning: Branch condition evaluates to
>  a garbage value
>        } else if (pending) {
>                   ^~~~~~~
>
> brcmf_sdio_dcmd_resp_wait() only sets pending to true.
> So pending needs to be initialized to false.

True. However, I prefer to fix it in brcmf_sdio_dcmd_resp_wait() and say:

*pending = signal_pending(current);

Regards,
Arend

> Fixes: 5b435de0d786 ("net: wireless: add brcm80211 drivers")
> Signed-off-by: Tom Rix <trix@redhat.com>
> ---
> drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
index d4989e0cd7be..403b123710ec 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
@@ -3233,7 +3233,7 @@  brcmf_sdio_bus_rxctl(struct device *dev, unsigned char *msg, uint msglen)
 {
 	int timeleft;
 	uint rxlen = 0;
-	bool pending;
+	bool pending = false;
 	u8 *buf;
 	struct brcmf_bus *bus_if = dev_get_drvdata(dev);
 	struct brcmf_sdio_dev *sdiodev = bus_if->bus_priv.sdio;