Patchwork mtd: maps: Remove redundant NULL check before kfree

login
register
mail settings
Submitter Syam Sidhardhan
Date Feb. 26, 2013, 7:46 p.m.
Message ID <1361908016-3110-1-git-send-email-s.syam@samsung.com>
Download mbox | patch
Permalink /patch/223380/
State Accepted
Commit 8be84e035c3f585f22f87034b41324681cf5c3ad
Headers show

Comments

Syam Sidhardhan - Feb. 26, 2013, 7:46 p.m.
kfree on NULL pointer is a no-op.

Signed-off-by: Syam Sidhardhan <s.syam@samsung.com>
---
 drivers/mtd/maps/ck804xrom.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
Artem Bityutskiy - March 8, 2013, 1:18 p.m.
On Wed, 2013-02-27 at 01:16 +0530, Syam Sidhardhan wrote:
> kfree on NULL pointer is a no-op.
> 
> Signed-off-by: Syam Sidhardhan <s.syam@samsung.com>

Pushed to l2-mtd.git, thanks!

Patch

diff --git a/drivers/mtd/maps/ck804xrom.c b/drivers/mtd/maps/ck804xrom.c
index 586a1c7..0455166 100644
--- a/drivers/mtd/maps/ck804xrom.c
+++ b/drivers/mtd/maps/ck804xrom.c
@@ -308,8 +308,7 @@  static int ck804xrom_init_one(struct pci_dev *pdev,
 
  out:
 	/* Free any left over map structures */
-	if (map)
-		kfree(map);
+	kfree(map);
 
 	/* See if I have any map structures */
 	if (list_empty(&window->maps)) {