[PATCH RESEND] brcmfmac: Add an error log for brcmf_sdiod_ramrw()

Wentao Liang posted 1 patch 9 months, 4 weeks ago
drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
[PATCH RESEND] brcmfmac: Add an error log for brcmf_sdiod_ramrw()
Posted by Wentao Liang 9 months, 4 weeks ago
The function brcmf_sdio_buscore_activate() calls the function
brcmf_sdiod_ramrw(), but does not check its return value. Log
the error message to prevent silent failure if the function fails.

Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
---
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
index b1727f35217b..dd683c2582fb 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c
@@ -3898,8 +3898,9 @@ static void brcmf_sdio_buscore_activate(void *ctx, struct brcmf_chip *chip,
 
 	if (rstvec)
 		/* Write reset vector to address 0 */
-		brcmf_sdiod_ramrw(sdiodev, true, 0, (void *)&rstvec,
-				  sizeof(rstvec));
+		if (brcmf_sdiod_ramrw(sdiodev, true, 0, (void *)&rstvec,
+				      sizeof(rstvec)) < 0)
+			brcmf_err("Fail to reset vector\n");
 }
 
 static u32 brcmf_sdio_buscore_read32(void *ctx, u32 addr)
-- 
2.42.0.windows.2
Re: [PATCH RESEND] brcmfmac: Add an error log for brcmf_sdiod_ramrw()
Posted by Arend van Spriel 6 months, 2 weeks ago
On 4/14/2025 9:42 AM, Wentao Liang wrote:
> The function brcmf_sdio_buscore_activate() calls the function
> brcmf_sdiod_ramrw(), but does not check its return value. Log
> the error message to prevent silent failure if the function fails.

Johannes delegated this to me in patchwork so catching up on what was 
already forgotten. Sorry about that.

The likelihood that writing the reset vector in device memory fails is 
next to nothing, because this step is done after we have written the 
firmware and nvram into device memory. Any issue accessing device memory 
would have cause a failure in those steps. So I suggest to drop this patch.

Regards,
Arend
Re: [PATCH RESEND] brcmfmac: Add an error log for brcmf_sdiod_ramrw()
Posted by Arend van Spriel 9 months, 4 weeks ago
On 4/14/2025 9:42 AM, Wentao Liang wrote:
> The function brcmf_sdio_buscore_activate() calls the function
> brcmf_sdiod_ramrw(), but does not check its return value. Log
> the error message to prevent silent failure if the function fails.

If the reset vector can not be written to device memory the firmware 
will not start and we get a probe failure. While it seems useful to log 
the error I suspect that the MMC/SDIO subsystem will also provide some 
feedback when we can not access the memory on the device (SDIO CMD52 
failure). Oh, well.

Acked-by: Arend van Spriel <arend.vanspriel@broadcom.com>
> Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
> ---
>   drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 5 +++--
>   1 file changed, 3 insertions(+), 2 deletions(-)