Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1371777

[PATCH] staging: wlan-ng: rewrite NULL comparison

Path csiph.com!aioe.org!bofh.it!news.nic.it!robomod
From Nicholas Sim <nicholassimws@gmail.com>
Newsgroups linux.kernel
Subject [PATCH] staging: wlan-ng: rewrite NULL comparison
Date Tue, 05 Apr 2016 18:40:01 +0200
Message-ID <rkCbf-6W6-3@gated-at.bofh.it> (permalink)
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :user-agent; bh=Q/ruFqDQzIy/NAVu/7JAGEmiIqbUyLsfoBwfKnagLtA=; b=slgANgEh/l3Cwo0+mIORYnq5HxndIGFnSUiIV40TTwgF6FblkCvDuebTM+zWetGxa8 jO9B55mhmQFCBRdUVjWVsETm9xtGLhjjUHly6dscONwRFu+m2M6Q6DWDxxdkYxdzEWR2 03SD+bdK0mytOouFeJHinfbiW1hzzw2/36CO+FkiS2X9pWVpd6++6WXeDiswOHmAJsPV otV6ntbKeLZfdIV54eLJwg0mV2leNDiSufMFKRm402eLLYdFNg98TA/yCgFteO3kCTNT tTHH3r0M6Rpv5hzLn1qTe7varoKGjMWCurLieV3DmtTpqEbr2g4eHRdLUBTowQ38ZW9l Aq2Q==
X-Google-Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:user-agent; bh=Q/ruFqDQzIy/NAVu/7JAGEmiIqbUyLsfoBwfKnagLtA=; b=RCQrXmLkIp/mmmoNRAWDawXgUuDSY9sVFJh+PdZolW0iw9NFTLgIrwZoLrLhPRuqv2 5NP2KjGtU9giwZ8no6+ZC0KXkt9gsHlE/yt/i/7AvFWlwK3zkrFcL9ZIKVVdiLqCU3Vp f6k1Ce5FtQ+thVVNgfa2dc/UsSjGVkQXkMer+PC4/S1CsaATPB/xmM1C7URfamr4tMKz pPUFk/ydK8tRpAM5rhhcJlU4s2P/DgSwMUH1yL95D9jSHaJgTcc+o5KI/rj2o5ixWJ4L ZGWYNcCo3INUIi6r6nZxtPSQZnbaUJN5maREQPE52P0/bl7FgI62kEFkE4anUvBlI8kG BULw==
X-Gm-Message-State AD7BkJK7YKqnjZGIQAOslwJegXI8Bo4F1H1nm657tzmoAnjJe17SPWwGO7dWFE5cltkcrw==
X-Received by 10.28.140.12 with SMTP id o12mr4513923wmd.19.1459874234467; Tue, 05 Apr 2016 09:37:14 -0700 (PDT)
MIME-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Disposition inline
User-Agent Mutt/1.5.24 (2015-08-30)
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 50
Organization linux.* mail to news gateway
X-Original-Cc linux-kernel@vger.kernel.org
X-Original-Date Tue, 5 Apr 2016 17:37:12 +0100
X-Original-Message-ID <20160405163712.GA20559@cog.davos>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1371777

Show key headers only | View raw


It is not necessary to compare explicitly to NULL. Rewrite if condition
as (!dev) or (dev) as suggested in Documentation/CodingStyle

Signed-off-by: Nicholas Sim <nicholassimws@gmail.com>
---
 drivers/staging/wlan-ng/hfa384x_usb.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/wlan-ng/hfa384x_usb.c b/drivers/staging/wlan-ng/hfa384x_usb.c
index 21a92df..3378107 100644
--- a/drivers/staging/wlan-ng/hfa384x_usb.c
+++ b/drivers/staging/wlan-ng/hfa384x_usb.c
@@ -614,7 +614,7 @@ static hfa384x_usbctlx_t *usbctlx_alloc(void)
 
 	ctlx = kzalloc(sizeof(*ctlx),
 		       in_interrupt() ? GFP_ATOMIC : GFP_KERNEL);
-	if (ctlx != NULL)
+	if (ctlx)
 		init_completion(&ctlx->done);
 
 	return ctlx;
@@ -797,7 +797,7 @@ static inline struct usbctlx_completor *init_rmem_completor(
 ----------------------------------------------------------------*/
 static void hfa384x_cb_status(hfa384x_t *hw, const hfa384x_usbctlx_t *ctlx)
 {
-	if (ctlx->usercb != NULL) {
+	if (ctlx->usercb) {
 		hfa384x_cmdresult_t cmdresult;
 
 		if (ctlx->state != CTLX_COMPLETE) {
@@ -2738,7 +2738,7 @@ static void hfa384x_usbctlx_completion_task(unsigned long data)
 		/* Call the completion function that this
 		 * command was assigned, assuming it has one.
 		 */
-		if (ctlx->cmdcb != NULL) {
+		if (ctlx->cmdcb) {
 			spin_unlock_irqrestore(&hw->ctlxq.lock, flags);
 			ctlx->cmdcb(hw, ctlx);
 			spin_lock_irqsave(&hw->ctlxq.lock, flags);
@@ -3629,7 +3629,7 @@ static void hfa384x_ctlxout_callback(struct urb *urb)
 	dbprint_urb(urb);
 #endif
 	if ((urb->status == -ESHUTDOWN) ||
-	    (urb->status == -ENODEV) || (hw == NULL))
+	    (urb->status == -ENODEV) || !hw)
 		return;
 
 retry:
-- 
2.4.3

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

[PATCH] staging: wlan-ng: rewrite NULL comparison Nicholas Sim <nicholassimws@gmail.com> - 2016-04-05 18:40 +0200

csiph-web