Re: [PATCH v2] brcm80211: fmac: Add error check for brcmf_usb_dlneeded()

Arend van Spriel <[email protected]>
Newsgroups dev.linux.lists.brcm80211,org.kernel.vger.linux-kernel,org.kernel.vger.linux-wireless
Message-ID <[email protected]>
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 <[email protected]>
> ---
> 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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.