diff mbox series

brcmfmac: uninitialized variable in brcmf_fw_get_firmwares()

Message ID 20210804082348.GA32730@kili (mailing list archive)
State Superseded
Delegated to: Kalle Valo
Headers show
Series brcmfmac: uninitialized variable in brcmf_fw_get_firmwares() | expand

Commit Message

Dan Carpenter Aug. 4, 2021, 8:23 a.m. UTC
The "ret" variable is used without being initialized when "alt_path" is
false.

Fixes: 5ff013914c62 ("brcmfmac: firmware: Allow per-board firmware binaries")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Linus Walleij Aug. 4, 2021, 9:39 a.m. UTC | #1
On Wed, Aug 4, 2021 at 10:24 AM Dan Carpenter <dan.carpenter@oracle.com> wrote:

> The "ret" variable is used without being initialized when "alt_path" is
> false.
>
> Fixes: 5ff013914c62 ("brcmfmac: firmware: Allow per-board firmware binaries")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Thanks Dan!

But yesterday I sent another patch which incidentally fixes
this too:
https://lore.kernel.org/linux-wireless/20210803232746.3389570-1-linus.walleij@linaro.org/T/#u

As you can see in the last hunk of that patch ret is now
unconditionally assigned on both forks of the
if/else-clause.

Yours,
Linus Walleij
diff mbox series

Patch

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/firmware.c
index adfdfc654b10..4f387e868120 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 = 0;
 
 	brcmf_dbg(TRACE, "enter: dev=%s\n", dev_name(dev));
 	if (!fw_cb)