brcmfmac: Fix fallback logic to use firmware's canonical path
PATCH 1/1 brcmfmac: Fix fallback logic to use firmware's canonical path
From: Tom Rix <[email protected]>
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.
--- drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c +1 -1
@@ -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)
Signature · 1 line
2.26.3
Quoted 7 lines · On Thu, Aug 12, 2021 at 7:03 PM <[email protected]> wrote:
From: Tom Rix <[email protected]>
Static analysis reports this problem
firmware.c:709:6: warning: Branch condition evaluates to a garbage valueif (ret) { ^~~
Quoted 6 lines
In
brcmf_fw_get_firmwares(), ret is only set if thealt_pathcontrol flow is taken. Initialize ret to -1, so the canonical path is taken ifalt_pathis not.Fixes 5ff013914c62 ("brcmfmac: firmware: Allow per-board firmware binaries")Signed-off-by Tom Rix <[email protected]>
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/[email protected]/
Yours,
Linus Walleij