* [PATCH] brcmfmac: initialize variable
@ 2020-09-13 14:35 trix
2020-09-14 4:12 ` Nathan Chancellor
2020-09-14 5:26 ` Arend Van Spriel
0 siblings, 2 replies; 3+ messages in thread
From: trix @ 2020-09-13 14:35 UTC (permalink / raw)
To: arend.vanspriel, franky.lin, hante.meuleman, chi-hsien.lin,
wright.feng, kvalo, davem, kuba, natechancellor, ndesaulniers,
smoch, dan.carpenter, double.lo, digetx, frank.kao, amsr,
stanley.hsu, saravanan.shanmugham, jean-philippe, linville
Cc: linux-wireless, brcm80211-dev-list.pdl, brcm80211-dev-list,
netdev, linux-kernel, clang-built-linux, Tom Rix
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(-)
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;
--
2.18.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] brcmfmac: initialize variable
2020-09-13 14:35 [PATCH] brcmfmac: initialize variable trix
@ 2020-09-14 4:12 ` Nathan Chancellor
2020-09-14 5:26 ` Arend Van Spriel
1 sibling, 0 replies; 3+ messages in thread
From: Nathan Chancellor @ 2020-09-14 4:12 UTC (permalink / raw)
To: trix
Cc: arend.vanspriel, franky.lin, hante.meuleman, chi-hsien.lin,
wright.feng, kvalo, davem, kuba, ndesaulniers, smoch,
dan.carpenter, double.lo, digetx, frank.kao, amsr, stanley.hsu,
saravanan.shanmugham, jean-philippe, linville, linux-wireless,
brcm80211-dev-list.pdl, brcm80211-dev-list, netdev, linux-kernel,
clang-built-linux
On Sun, Sep 13, 2020 at 07:35:22AM -0700, 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.
>
> Fixes: 5b435de0d786 ("net: wireless: add brcm80211 drivers")
> Signed-off-by: Tom Rix <trix@redhat.com>
Reviewed-by: Nathan Chancellor <natechancellor@gmail.com>
> ---
> drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> 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;
> --
> 2.18.1
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] brcmfmac: initialize variable
2020-09-13 14:35 [PATCH] brcmfmac: initialize variable trix
2020-09-14 4:12 ` Nathan Chancellor
@ 2020-09-14 5:26 ` Arend Van Spriel
1 sibling, 0 replies; 3+ messages in thread
From: Arend Van Spriel @ 2020-09-14 5:26 UTC (permalink / raw)
To: trix, franky.lin, hante.meuleman, chi-hsien.lin, wright.feng,
kvalo, davem, kuba, natechancellor, ndesaulniers, smoch,
dan.carpenter, double.lo, digetx, frank.kao, amsr, stanley.hsu,
saravanan.shanmugham, jean-philippe, linville
Cc: linux-wireless, brcm80211-dev-list.pdl, brcm80211-dev-list,
netdev, linux-kernel, clang-built-linux
[-- Attachment #1: Type: text/plain, Size: 734 bytes --]
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(-)
[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4176 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-09-14 5:26 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-13 14:35 [PATCH] brcmfmac: initialize variable trix
2020-09-14 4:12 ` Nathan Chancellor
2020-09-14 5:26 ` Arend Van Spriel
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).