Skip to contentSkip to conversation

brcmfmac: Remove unnecessary NULL-check.

PATCH In review Daniil Dulov 3 participants 5 messages Feb 11, 2024 – Feb 12, 2024

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 brcmfmac: Remove unnecessary NULL-check.

In this case req will never be NULL, so remove unnecessary check.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes 71bb244ba2fd ("brcm80211: fmac: add USB support for bcm43235/6/8 chipsets")
---
 drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c +1 -2
index 9fb68c2dc7e3..38e4e4f32a39 100644
@@ -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);
 	}
 	kfree(reqs);
Signature · 1 line
2.25.1
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 3 lines · Daniil Dulov

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.

Quoted 1 line
Fixes 71bb244ba2fd ("brcm80211: fmac: add USB support for bcm43235/6/8 chipsets")
Quoted 10 lines
---
  drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c +0 -0
index 9fb68c2dc7e3..38e4e4f32a39 100644

drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c brcmf_usbdev_qinit(struct list_head *q, int qsize) · line 460

Quoted 8 lines
drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c +1 -2
@@ -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().

Quoted 1 line
drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c +0 -0
  	kfree(reqs);
maintainer
#2 lore raw
Quoted 14 lines · Arend van Spriel
Quoted 3 lines · Daniil Dulov

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.

Quoted 1 line
Fixes 71bb244ba2fd ("brcm80211: fmac: add USB support for bcm43235/6/8 chipsets")
Quoted 5 lines

---
  drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c | 3 +--

  1 file changed, 1 insertion(+), 2 deletions(-)
Quoted 15 lines

drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c brcmf_usbdev_qinit(struct list_head *q, int qsize) · line 460

Quoted 13 lines
drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c +1 -2
index 9fb68c2dc7e3..38e4e4f32a39 100644
@@ -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().

That "Ay you are ..." should be "As you are ...".

Quoted 1 line
Quoted 1 line
drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c +0 -0
       kfree(reqs);
#3 lore raw

Hello!

Thank you for the review! I'll correct the patch and send the 2nd version today.

Daniil Dulov

-----Original Message-----
From: Arend van Spriel [mailto:[email protected]]
Sent: Sunday, February 11, 2024 10:27 PM
To: Daniil Dulov <[email protected]>; Kalle Valo <[email protected]>
Cc: David S. Miller <[email protected]>; Jakub Kicinski <[email protected]>; Pieter-Paul Giesberts <[email protected]>; Franky (Zhenhui) Lin <[email protected]>; John W. Linville <[email protected]>; Kan Yan <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH] brcmfmac: Remove unnecessary NULL-check.

Quoted 25 lines · Arend van Spriel
Quoted 3 lines · Daniil Dulov

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.

Quoted 2 lines
Fixes 71bb244ba2fd ("brcm80211: fmac: add USB support for

bcm43235/6/8 chipsets")

Quoted 14 lines

---
  drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c | 3 +--

  1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c +0 -0
index 9fb68c2dc7e3..38e4e4f32a39 100644
@@ -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);
Quoted 8 lines

drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c brcmf_usbdev_qinit(struct list_head *q, int qsize) · line 460

Quoted 5 lines
drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c +1 -2
-        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().

That "Ay you are ..." should be "As you are ...".

Quoted 1 line
Quoted 1 line
drivers/net/wireless/broadcom/brcm80211/brcmfmac/usb.c +0 -0
       kfree(reqs);
#4 lore raw
In reply to Arend van Spriel
Quoted 9 lines · Arend van Spriel
Quoted 2 lines · Daniil Dulov

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.

Quoted 1 line
Fixes 71bb244ba2fd ("brcm80211: fmac: add USB support for bcm43235/6/8 chipsets")

Yeah, this is not a fix and the Fixes tag should be removed.

Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches