diff mbox

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

Message ID 1353409024-28853-1-git-send-email-sachin.kamat@linaro.org
State Accepted
Headers show

Commit Message

Sachin Kamat Nov. 20, 2012, 10:57 a.m. UTC
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(-)

Comments

David Miller Nov. 20, 2012, 8:53 p.m. UTC | #1
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.
diff mbox

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;
 	}