Patchwork [1/2] net: Remove redundant null check before kfree in dev.c

login
register
mail settings
Submitter Sachin Kamat
Date Nov. 20, 2012, 10:57 a.m.
Message ID <1353409024-28853-1-git-send-email-sachin.kamat@linaro.org>
Download mbox | patch
Permalink /patch/200294/
State Accepted
Delegated to: David Miller
Headers show

Comments

Sachin Kamat - Nov. 20, 2012, 10:57 a.m.
kfree on a null pointer is a no-op.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
---
 net/core/dev.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)
David Miller - Nov. 20, 2012, 8:53 p.m.
From: Sachin Kamat <sachin.kamat@linaro.org>
Date: Tue, 20 Nov 2012 16:27:04 +0530

> kfree on a null pointer is a no-op.
> 
> Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>

Applied.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/net/core/dev.c b/net/core/dev.c
index 83232a1..c380913 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1075,10 +1075,8 @@  int dev_set_alias(struct net_device *dev, const char *alias, size_t len)
 		return -EINVAL;
 
 	if (!len) {
-		if (dev->ifalias) {
-			kfree(dev->ifalias);
-			dev->ifalias = NULL;
-		}
+		kfree(dev->ifalias);
+		dev->ifalias = NULL;
 		return 0;
 	}