[lvc-project] [PATCH] brcmfmac: Remove unnecessary NULL-check.

Arend van Spriel arend.vanspriel at broadcom.com
Sun Feb 11 22:25:21 MSK 2024


On 2/11/2024 4:05 PM, Daniil Dulov wrote:
> In this case req will never be NULL, so remove unnecessary check.
> 
> Found by Linux Verification Center (linuxtesting.org) with SVACE.

Looks good to me, but when do we call things a "fix" and when is 
"improvement" more appropriate.

> Fixes: 71bb244ba2fd ("brcm80211: fmac: add USB support for bcm43235/6/8 chipsets")
Reviewed-by: Arend van Spriel <arend.vanspriel at broadcom.com>
> Signed-off-by: Daniil Dulov <d.dulov at aladdin.ru>
> ---
>   drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c
> index 9fb68c2dc7e3..38e4e4f32a39 100644
> --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c
> +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c
> @@ -455,8 +455,7 @@ brcmf_usbdev_qinit(struct list_head *q, int qsize)
>   	brcmf_err("fail!\n");
>   	while (!list_empty(q)) {
>   		req = list_entry(q->next, struct brcmf_usbreq, list);
> -		if (req)
> -			usb_free_urb(req->urb);
> +		usb_free_urb(req->urb);
>   		list_del(q->next);
>   	}

Ay you are already touching this code you could consider using 
list_for_each_entry_safe().

>   	kfree(reqs);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4219 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://linuxtesting.org/pipermail/lvc-project/attachments/20240211/6f8a51ee/attachment.bin>


More information about the lvc-project mailing list