Message ID | 20240211150516.3475-1-d.dulov@aladdin.ru |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-60809-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp1966506dyd; Sun, 11 Feb 2024 07:06:10 -0800 (PST) X-Google-Smtp-Source: AGHT+IGOPokC1phauo/4tLgQdZ6Fcyvhr6yjPrnePD1Z3spCvZuiw0TwIfh+9pHdTdjsNx6RSPSt X-Received: by 2002:a05:6a20:43ab:b0:19c:5523:eefe with SMTP id i43-20020a056a2043ab00b0019c5523eefemr7371424pzl.3.1707663969840; Sun, 11 Feb 2024 07:06:09 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707663969; cv=pass; d=google.com; s=arc-20160816; b=fEUezld76WHzFuPL5CApFVmYIAefFflj7dm0JZtnWQ+8ugUqQ/I0FvMPcF8f4bQiEs s7xR6bPhiBvVRl3XFXoX/TovuYNEm/hnKGD0cCz4rgpPlYFRt7W4kcIrZtzu3vJV9Sfq q0tyGGyexajWZ8hnzLwVRQj0LI0KByv5KyEw0WkoCBGL6u11GUBsc2FL6xMU5xGFitsx BikQaCYXzkpqBQOEmCAzD0iFEGJLep5HqKT5RWGTFgSCgWRBTvpx5Jf7VAEIVkB2+CHq Nf3R4ZDNIvNil33FVWP7yB59YaFOZ48oxVLW0KoctxWPfc2H/rpq/ETVzjlanaxNw7Ih phWQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from; bh=nryRx597cKchFYb8UnXmB2/zDqeJYBtu9RIwauqLqMU=; fh=tUHMvuaK3n0i499mcmacYsnz8HfYPvadjYIA0FUt5fE=; b=Hl9gEp2RlLUbqblKeEnckVIaTtXJrClPq2j0ziRYBrrSkgIK0YFBjv7QnFGZFjD4gP gk0RZJQ/L9ETAVWQ4dh/3bHRDrfgl9WJyUEmU7mh8Zzkc0SQv7w95IGTOu7drlvOtP3u xIBamR3CIA4F5SS159+bE0opvJBvzAo4L1wptGBfOZ7Myngg+kgoM6miKYsFkW5jHx6J 2bL6PkgJqFN+L9J45qWeLzapPccXMVWXdTWbiu2y4st+mM7EmfYhh2H1YalHmskuLd+T 8uiicRNKI6t/KFwoHIRVXxP6mMGFDPopRwMqa3AGcNSOHKRQaQ7MG5YrqaWcNr/JD+4x u+Yw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=aladdin.ru dmarc=pass fromdomain=aladdin.ru); spf=pass (google.com: domain of linux-kernel+bounces-60809-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60809-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aladdin.ru X-Forwarded-Encrypted: i=2; AJvYcCWZwUbQOaaznPEpq1tz+SdabVafMveHaW0WI3EjGIRwrXkFO9DlHdKWXCj2F2L7ydulyu9CEY/0vYs2yq0wTXpGcG6+Ow== Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id ka30-20020a056a00939e00b006e03efbcb54si3597258pfb.315.2024.02.11.07.06.09 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Feb 2024 07:06:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-60809-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=aladdin.ru dmarc=pass fromdomain=aladdin.ru); spf=pass (google.com: domain of linux-kernel+bounces-60809-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60809-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aladdin.ru Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id BFE5FB21543 for <ouuuleilei@gmail.com>; Sun, 11 Feb 2024 15:06:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5DC2A5BACE; Sun, 11 Feb 2024 15:05:42 +0000 (UTC) Received: from mail-out.aladdin-rd.ru (mail-out.aladdin-rd.ru [91.199.251.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 120C01E4B9; Sun, 11 Feb 2024 15:05:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.199.251.16 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707663940; cv=none; b=Fe1mLglXCLMLOs2pj69RSzD6HNL0F0TZSj/BwyNHQtBwEENKHrjFDPYS1VoFDosG0h1U6+nGmdaMumoBft4vCgv/E2v5B3LrQ+CwVNv47srs9/0cayMIYaNp6IXqYNO/ekViOY1Ua838prpMqp5SbdaiMO2IfhYwaku0ZO9qkOQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707663940; c=relaxed/simple; bh=EVfYYXla2kngYHRfq5dYArFnPPlhtCqitcRxBeUUBj4=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=Ll/5RnWJYGjB/EwW8d8G4rH9i4idiwbUEI/WregvEhHjaW8/USVgNzccq3DkuO0Xw1ZXyGYazvfUN8Vl/zDzfs20aU0TfVbjDDaoYhN9vZx4kD9f9nnDbhAwh6DZ/Z7ls7nMSrrYtaC0CCxKJNA94LQoxiKc0FCgFvzeKEdGybk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=aladdin.ru; spf=pass smtp.mailfrom=aladdin.ru; arc=none smtp.client-ip=91.199.251.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=aladdin.ru Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=aladdin.ru From: Daniil Dulov <d.dulov@aladdin.ru> To: Kalle Valo <kvalo@codeaurora.org> CC: Daniil Dulov <d.dulov@aladdin.ru>, "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: [PATCH] brcmfmac: Remove unnecessary NULL-check. Date: Sun, 11 Feb 2024 07:05:16 -0800 Message-ID: <20240211150516.3475-1-d.dulov@aladdin.ru> X-Mailer: git-send-email 2.25.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: EXCH-2016-02.aladdin.ru (192.168.1.102) To EXCH-2016-01.aladdin.ru (192.168.1.101) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790615454798412725 X-GMAIL-MSGID: 1790615454798412725 |
Series |
brcmfmac: Remove unnecessary NULL-check.
|
|
Commit Message
Daniil Dulov
Feb. 11, 2024, 3:05 p.m. UTC
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(-)
Comments
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);
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);
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.
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);
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);