netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] brcmfmac: Remove unnecessary NULL-check.
@ 2024-02-11 15:05 Daniil Dulov
  2024-02-11 19:25 ` Arend van Spriel
  0 siblings, 1 reply; 5+ messages in thread
From: Daniil Dulov @ 2024-02-11 15:05 UTC (permalink / raw)
  To: Kalle Valo
  Cc: Daniil Dulov, David S. Miller, Jakub Kicinski,
	Pieter-Paul Giesberts, Franky (Zhenhui) Lin, John W. Linville,
	Kan Yan, linux-wireless, brcm80211-dev-list.pdl,
	SHA-cyfmac-dev-list, netdev, linux-kernel, lvc-project

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")
Signed-off-by: Daniil Dulov <d.dulov@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);
 	}
 	kfree(reqs);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] brcmfmac: Remove unnecessary NULL-check.
  2024-02-11 15:05 [PATCH] brcmfmac: Remove unnecessary NULL-check Daniil Dulov
@ 2024-02-11 19:25 ` Arend van Spriel
  2024-02-11 19:26   ` Arend van Spriel
  2024-02-12  7:27   ` Kalle Valo
  0 siblings, 2 replies; 5+ messages in thread
From: Arend van Spriel @ 2024-02-11 19:25 UTC (permalink / raw)
  To: Daniil Dulov, Kalle Valo
  Cc: David S. Miller, Jakub Kicinski, Pieter-Paul Giesberts,
	Franky (Zhenhui) Lin, John W. Linville, Kan Yan, linux-wireless,
	brcm80211-dev-list.pdl, SHA-cyfmac-dev-list, netdev, linux-kernel,
	lvc-project

[-- Attachment #1: Type: text/plain, Size: 1307 bytes --]

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@broadcom.com>
> Signed-off-by: Daniil Dulov <d.dulov@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);

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4219 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] brcmfmac: Remove unnecessary NULL-check.
  2024-02-11 19:25 ` Arend van Spriel
@ 2024-02-11 19:26   ` Arend van Spriel
  2024-02-12  7:52     ` Daniil Dulov
  2024-02-12  7:27   ` Kalle Valo
  1 sibling, 1 reply; 5+ messages in thread
From: Arend van Spriel @ 2024-02-11 19:26 UTC (permalink / raw)
  To: Daniil Dulov, Kalle Valo
  Cc: David S. Miller, Jakub Kicinski, Pieter-Paul Giesberts,
	Franky (Zhenhui) Lin, John W. Linville, Kan Yan, linux-wireless,
	brcm80211-dev-list.pdl, SHA-cyfmac-dev-list, netdev, linux-kernel,
	lvc-project

[-- Attachment #1: Type: text/plain, Size: 1561 bytes --]

On 2/11/2024 8:25 PM, Arend van Spriel wrote:
> 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@broadcom.com>
>> Signed-off-by: Daniil Dulov <d.dulov@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().

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

>>       kfree(reqs);

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4219 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] brcmfmac: Remove unnecessary NULL-check.
  2024-02-11 19:25 ` Arend van Spriel
  2024-02-11 19:26   ` Arend van Spriel
@ 2024-02-12  7:27   ` Kalle Valo
  1 sibling, 0 replies; 5+ messages in thread
From: Kalle Valo @ 2024-02-12  7:27 UTC (permalink / raw)
  To: Arend van Spriel
  Cc: Daniil Dulov, David S. Miller, Jakub Kicinski,
	Pieter-Paul Giesberts, Franky (Zhenhui) Lin, John W. Linville,
	Kan Yan, linux-wireless, brcm80211-dev-list.pdl,
	SHA-cyfmac-dev-list, netdev, linux-kernel, lvc-project

Arend van Spriel <arend.vanspriel@broadcom.com> writes:

> 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@broadcom.com>

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

-- 
https://patchwork.kernel.org/project/linux-wireless/list/

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [PATCH] brcmfmac: Remove unnecessary NULL-check.
  2024-02-11 19:26   ` Arend van Spriel
@ 2024-02-12  7:52     ` Daniil Dulov
  0 siblings, 0 replies; 5+ messages in thread
From: Daniil Dulov @ 2024-02-12  7:52 UTC (permalink / raw)
  To: Arend van Spriel, Kalle Valo
  Cc: David S. Miller, Jakub Kicinski, Pieter-Paul Giesberts,
	Franky (Zhenhui) Lin, John W. Linville, Kan Yan,
	linux-wireless@vger.kernel.org,
	brcm80211-dev-list.pdl@broadcom.com,
	SHA-cyfmac-dev-list@infineon.com, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, lvc-project@linuxtesting.org

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:arend.vanspriel@broadcom.com] 
Sent: Sunday, February 11, 2024 10:27 PM
To: Daniil Dulov <D.Dulov@aladdin.ru>; Kalle Valo <kvalo@codeaurora.org>
Cc: David S. Miller <davem@davemloft.net>; Jakub Kicinski <kuba@kernel.org>; Pieter-Paul Giesberts <pieterpg@broadcom.com>; Franky (Zhenhui) Lin <frankyl@broadcom.com>; John W. Linville <linville@tuxdriver.com>; Kan Yan <kanyan@broadcom.com>; linux-wireless@vger.kernel.org; brcm80211-dev-list.pdl@broadcom.com; SHA-cyfmac-dev-list@infineon.com; netdev@vger.kernel.org; linux-kernel@vger.kernel.org; lvc-project@linuxtesting.org
Subject: Re: [PATCH] brcmfmac: Remove unnecessary NULL-check.

On 2/11/2024 8:25 PM, Arend van Spriel wrote:
> 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@broadcom.com>
>> Signed-off-by: Daniil Dulov <d.dulov@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().

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

>>       kfree(reqs);

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-02-12  7:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-11 15:05 [PATCH] brcmfmac: Remove unnecessary NULL-check Daniil Dulov
2024-02-11 19:25 ` Arend van Spriel
2024-02-11 19:26   ` Arend van Spriel
2024-02-12  7:52     ` Daniil Dulov
2024-02-12  7:27   ` Kalle Valo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).