From cf285c8f98440787f8a19620e7747e753bd840ea Mon Sep 17 00:00:00 2001 From: avishad verma Date: Tue, 1 Jul 2025 03:21:24 -0500 Subject: [PATCH] brcmfmac: handle SDIO readl command error. In the current implementation, the sdio_readl command can fail and return 0xFFFFFFFF. However, in several instances within the existing code, there is no explicit validation to determine whether the sdio_readl operation was successful before using its return value. This oversight leads to scenarios where the returned 0xFFFFFFFF value is interpreted as valid data, causing driver to execute incorrect operations. One such scenario occurs when the driver detects a firmware (FW) crash. In reality, the observed behavior is due to the failure of the sdio_readl command rather than an actual FW crash. The use of 0xFFFFFFFF as a valid return value misleads the driver logic, resulting in erroneous conclusions. To mitigate this, the return value of sdio_readl is modilied to 0 in failure scenarios. Fixes SWWLAN-153098 Signed-off-by: avishad verma --- drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c index 8aaf5dbc2f22..67841b8e60aa 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/bcmsdh.c @@ -283,6 +283,9 @@ u32 brcmf_sdiod_readl(struct brcmf_sdio_dev *sdiodev, u32 addr, int *ret) data = sdio_readl(sdiodev->func1, addr, &retval); + if (retval) + data = 0; + brcmf_dbg(SDIO, "data 0x%08x\n", data); out: if (ret)