* [PATCH v2] brcm80211: fmac: Add error check for brcmf_usb_dlneeded()
@ 2025-04-14 2:28 Wentao Liang
2025-04-14 9:33 ` Arend van Spriel
0 siblings, 1 reply; 2+ messages in thread
From: Wentao Liang @ 2025-04-14 2:28 UTC (permalink / raw)
To: arend.vanspriel, kvalo
Cc: linux-wireless, brcm80211, brcm80211-dev-list.pdl, linux-kernel,
Wentao Liang
The function brcmf_usb_dlneeded() calls the function brcmf_usb_dl_cmd()
but dose not check its return value. Though there is an error log in the
brcmf_usb_dl_cmd(), it is not clear enough to describe the error state.
Add error handling in brcmf_usb_dlneeded() to log the error message if
the brcmf_usb_dl_cmd() fails.
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
---
v2: Remove redundant bailing out code.
drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c
index 2821c27f317e..8e2b41cfe5cf 100644
--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c
+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c
@@ -790,6 +790,7 @@ brcmf_usb_dlneeded(struct brcmf_usbdev_info *devinfo)
{
struct bootrom_id_le id;
u32 chipid, chiprev;
+ int err;
brcmf_dbg(USB, "Enter\n");
@@ -798,7 +799,9 @@ brcmf_usb_dlneeded(struct brcmf_usbdev_info *devinfo)
/* Check if firmware downloaded already by querying runtime ID */
id.chip = cpu_to_le32(0xDEAD);
- brcmf_usb_dl_cmd(devinfo, DL_GETVER, &id, sizeof(id));
+ err = brcmf_usb_dl_cmd(devinfo, DL_GETVER, &id, sizeof(id));
+ if (err)
+ brcmf_err("DL_GETVER failed: err=%d\n", err);
chipid = le32_to_cpu(id.chip);
chiprev = le32_to_cpu(id.chiprev);
--
2.42.0.windows.2
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH v2] brcm80211: fmac: Add error check for brcmf_usb_dlneeded()
2025-04-14 2:28 [PATCH v2] brcm80211: fmac: Add error check for brcmf_usb_dlneeded() Wentao Liang
@ 2025-04-14 9:33 ` Arend van Spriel
0 siblings, 0 replies; 2+ messages in thread
From: Arend van Spriel @ 2025-04-14 9:33 UTC (permalink / raw)
To: Wentao Liang, kvalo
Cc: linux-wireless, brcm80211, brcm80211-dev-list.pdl, linux-kernel
On 4/14/2025 4:28 AM, Wentao Liang wrote:
> The function brcmf_usb_dlneeded() calls the function brcmf_usb_dl_cmd()
> but dose not check its return value. Though there is an error log in the
> brcmf_usb_dl_cmd(), it is not clear enough to describe the error state.
>
> Add error handling in brcmf_usb_dlneeded() to log the error message if
> the brcmf_usb_dl_cmd() fails.
>
> Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
> ---
> v2: Remove redundant bailing out code.
>
> drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c
> index 2821c27f317e..8e2b41cfe5cf 100644
> --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c
> +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c
> @@ -790,6 +790,7 @@ brcmf_usb_dlneeded(struct brcmf_usbdev_info *devinfo)
> {
> struct bootrom_id_le id;
> u32 chipid, chiprev;
> + int err;
>
> brcmf_dbg(USB, "Enter\n");
>
> @@ -798,7 +799,9 @@ brcmf_usb_dlneeded(struct brcmf_usbdev_info *devinfo)
>
> /* Check if firmware downloaded already by querying runtime ID */
> id.chip = cpu_to_le32(0xDEAD);
> - brcmf_usb_dl_cmd(devinfo, DL_GETVER, &id, sizeof(id));
> + err = brcmf_usb_dl_cmd(devinfo, DL_GETVER, &id, sizeof(id));
> + if (err)
> + brcmf_err("DL_GETVER failed: err=%d\n", err);
Please move printing the error message inside brcmf_usb_dl_cmd() as I
mentioned before. That way we also get an error message for all DL_*
commands like DL_START (which came up in another patch).
Regards,
Arend
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-04-14 9:33 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-04-14 2:28 [PATCH v2] brcm80211: fmac: Add error check for brcmf_usb_dlneeded() Wentao Liang
2025-04-14 9:33 ` Arend van Spriel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®