linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] brcmfmac: Fix fallback logic to use firmware's canonical path
@ 2021-08-12 17:03 trix
  2021-08-13  8:55 ` Linus Walleij
  0 siblings, 1 reply; 2+ messages in thread
From: trix @ 2021-08-12 17:03 UTC (permalink / raw)
  To: aspriel, franky.lin, hante.meuleman, chi-hsien.lin, wright.feng,
	chung-hsien.hsu, kvalo, davem, kuba, zhengyongjun3,
	linus.walleij, lee.jones
  Cc: linux-wireless, brcm80211-dev-list.pdl, SHA-cyfmac-dev-list,
	netdev, linux-kernel, Tom Rix

From: Tom Rix <trix@redhat.com>

Static analysis reports this problem
firmware.c:709:6: warning: Branch condition evaluates to a garbage value
        if (ret) {
            ^~~

In brcmf_fw_get_firmwares(), ret is only set if the alt_path control
flow is taken.  Initialize ret to -1, so the canonical path is taken
if alt_path is not.

Fixes: 5ff013914c62 ("brcmfmac: firmware: Allow per-board firmware binaries")
Signed-off-by: Tom Rix <trix@redhat.com>
---
 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 adfdfc654b104..e11f1a3a38a59 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
@@ -680,7 +680,7 @@ int brcmf_fw_get_firmwares(struct device *dev, struct brcmf_fw_request *req,
 	struct brcmf_fw_item *first = &req->items[0];
 	struct brcmf_fw *fwctx;
 	char *alt_path;
-	int ret;
+	int ret = -1;
 
 	brcmf_dbg(TRACE, "enter: dev=%s\n", dev_name(dev));
 	if (!fw_cb)
-- 
2.26.3


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] brcmfmac: Fix fallback logic to use firmware's canonical path
  2021-08-12 17:03 [PATCH] brcmfmac: Fix fallback logic to use firmware's canonical path trix
@ 2021-08-13  8:55 ` Linus Walleij
  0 siblings, 0 replies; 2+ messages in thread
From: Linus Walleij @ 2021-08-13  8:55 UTC (permalink / raw)
  To: trix
  Cc: Arend van Spriel, Franky Lin, Hante Meuleman, Chi-hsien Lin,
	Wright Feng, Chung-hsien Hsu, Kalle Valo, David S. Miller,
	Jakub Kicinski, Zheng Yongjun, Lee Jones, linux-wireless,
	brcm80211-dev-list.pdl, SHA-cyfmac-dev-list, netdev,
	linux-kernel

On Thu, Aug 12, 2021 at 7:03 PM <trix@redhat.com> wrote:

> From: Tom Rix <trix@redhat.com>
>
> Static analysis reports this problem
> firmware.c:709:6: warning: Branch condition evaluates to a garbage value
>         if (ret) {
>             ^~~
>
> In brcmf_fw_get_firmwares(), ret is only set if the alt_path control
> flow is taken.  Initialize ret to -1, so the canonical path is taken
> if alt_path is not.
>
> Fixes: 5ff013914c62 ("brcmfmac: firmware: Allow per-board firmware binaries")
> Signed-off-by: Tom Rix <trix@redhat.com>

Thanks!

But we are working on a more generic solution to this and other
problems in a patch that Dmitry has asked Kalle to merge.
https://lore.kernel.org/linux-wireless/20210808180510.8753-1-digetx@gmail.com/

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-08-13  8:55 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-12 17:03 [PATCH] brcmfmac: Fix fallback logic to use firmware's canonical path trix
2021-08-13  8:55 ` Linus Walleij

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).