Patchwork [1/1] caif: Remove redundant null check before kfree in cfctrl.c

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

Comments

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

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
---
 net/caif/cfctrl.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
sjur.brandeland@stericsson.com - Nov. 20, 2012, 11:04 a.m.
> kfree on a null pointer is a no-op.
> 
> Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Acked-by: Sjur Brændeland <sjur.brandeland@stericsson.com>
--
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
David Miller - Nov. 20, 2012, 8:53 p.m.
From: Sjur BRENDELAND <sjur.brandeland@stericsson.com>
Date: Tue, 20 Nov 2012 12:04:23 +0100

>> kfree on a null pointer is a no-op.
>> 
>> Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
> Acked-by: Sjur Brændeland <sjur.brandeland@stericsson.com>

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/caif/cfctrl.c b/net/caif/cfctrl.c
index 44f270f..a376ec1 100644
--- a/net/caif/cfctrl.c
+++ b/net/caif/cfctrl.c
@@ -515,8 +515,7 @@  static int cfctrl_recv(struct cflayer *layer, struct cfpkt *pkt)
 							  client_layer : NULL);
 			}
 
-			if (req != NULL)
-				kfree(req);
+			kfree(req);
 
 			spin_unlock_bh(&cfctrl->info_list_lock);
 		}