2014-06-23 17:34:08

by Fabian Frédérick

[permalink] [raw]
Subject: [PATCH V2] net/dsa/dsa.c: remove unnecessary null test before kfree

Fix checkpatch warning:
WARNING: kfree(NULL) is safe this check is probably not required

Cc: "David S. Miller" <[email protected]>
Cc: Grant Likely <[email protected]>
Cc: [email protected]
Cc: Joe Perches <[email protected]>
Signed-off-by: Fabian Frederick <[email protected]>
---
V2: Use more appropriate subject (suggested by Joe Perches).

net/dsa/dsa.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c
index 5db37ce..0a49632 100644
--- a/net/dsa/dsa.c
+++ b/net/dsa/dsa.c
@@ -351,8 +351,7 @@ static void dsa_of_free_platform_data(struct dsa_platform_data *pd)
for (i = 0; i < pd->nr_chips; i++) {
port_index = 0;
while (port_index < DSA_MAX_PORTS) {
- if (pd->chip[i].port_names[port_index])
- kfree(pd->chip[i].port_names[port_index]);
+ kfree(pd->chip[i].port_names[port_index]);
port_index++;
}
kfree(pd->chip[i].rtable);
--
1.8.4.5


2014-06-25 23:15:37

by David Miller

[permalink] [raw]
Subject: Re: [PATCH V2] net/dsa/dsa.c: remove unnecessary null test before kfree

From: Fabian Frederick <[email protected]>
Date: Mon, 23 Jun 2014 19:32:47 +0200

> Fix checkpatch warning:
> WARNING: kfree(NULL) is safe this check is probably not required
>
> Cc: "David S. Miller" <[email protected]>
> Cc: Grant Likely <[email protected]>
> Cc: [email protected]
> Cc: Joe Perches <[email protected]>
> Signed-off-by: Fabian Frederick <[email protected]>

Applied, thanks.