brcmfmac: initialize variable
PATCH 1/1 brcmfmac: initialize variable
From: Tom Rix <[email protected]>
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.
--- drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +1 -1
@@ -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;
Signature · 1 line
2.18.1
Quoted 5 lines · On Sun, Sep 13, 2020 at 07:35:22AM -0700, [email protected] wrote:
From: Tom Rix <[email protected]>
clang static analysis flags this problem sdio.c:3265:13: warning: Branch condition evaluates to
a garbage value
Quoted 8 lines
} 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 <[email protected]>
Quoted 20 lines
--- drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +1
-1@@ -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;Signature · 1 line
2.18.1
Arend Van Spriel
maintainerQuoted 10 lines · On September 13, 2020 4:35:44 PM [email protected] wrote:
From: Tom Rix <[email protected]>
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
Quoted 5 lines
Fixes 5b435de0d786 ("net: wireless: add brcm80211 drivers")Signed-off-by Tom Rix <[email protected]>---
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c| 2 +-1 file changed, 1 insertion(+), 1 deletion(-)