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


Groups > linux.kernel > #1720701 > unrolled thread

[PATCH] net: ethernet: broadcom: Remove null check before kfree

Started byHimanshu Jha <himanshujha199640@gmail.com>
First post2017-08-26 22:20 +0200
Last post2017-08-29 01:00 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] net: ethernet: broadcom: Remove null check before kfree Himanshu Jha <himanshujha199640@gmail.com> - 2017-08-26 22:20 +0200
    Re: [PATCH] net: ethernet: broadcom: Remove null check before kfree David Miller <davem@davemloft.net> - 2017-08-29 01:00 +0200

#1720701 — [PATCH] net: ethernet: broadcom: Remove null check before kfree

FromHimanshu Jha <himanshujha199640@gmail.com>
Date2017-08-26 22:20 +0200
Subject[PATCH] net: ethernet: broadcom: Remove null check before kfree
Message-ID<uiPIK-5NM-13@gated-at.bofh.it>
Kfree on NULL pointer is a no-op and therefore checking is redundant.

Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>
---
 drivers/net/ethernet/broadcom/sb1250-mac.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/sb1250-mac.c b/drivers/net/ethernet/broadcom/sb1250-mac.c
index 16a0f19..ecdef42 100644
--- a/drivers/net/ethernet/broadcom/sb1250-mac.c
+++ b/drivers/net/ethernet/broadcom/sb1250-mac.c
@@ -1367,15 +1367,11 @@ static int sbmac_initctx(struct sbmac_softc *s)
 
 static void sbdma_uninitctx(struct sbmacdma *d)
 {
-	if (d->sbdma_dscrtable_unaligned) {
-		kfree(d->sbdma_dscrtable_unaligned);
-		d->sbdma_dscrtable_unaligned = d->sbdma_dscrtable = NULL;
-	}
+	kfree(d->sbdma_dscrtable_unaligned);
+	d->sbdma_dscrtable_unaligned = d->sbdma_dscrtable = NULL;
 
-	if (d->sbdma_ctxtable) {
-		kfree(d->sbdma_ctxtable);
-		d->sbdma_ctxtable = NULL;
-	}
+	kfree(d->sbdma_ctxtable);
+	d->sbdma_ctxtable = NULL;
 }
 
 
-- 
2.7.4

[toc] | [next] | [standalone]


#1722043

FromDavid Miller <davem@davemloft.net>
Date2017-08-29 01:00 +0200
Message-ID<ujBaF-2X6-11@gated-at.bofh.it>
In reply to#1720701
From: Himanshu Jha <himanshujha199640@gmail.com>
Date: Sun, 27 Aug 2017 01:47:47 +0530

> Kfree on NULL pointer is a no-op and therefore checking is redundant.
> 
> Signed-off-by: Himanshu Jha <himanshujha199640@gmail.com>

Applied.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web