[PATCH] net: dsa: remove redundant null pointer check before put_device

Subsystems: networking [dsa], networking [general], the rest

STALE2927d

2 messages, 2 authors, 2018-09-17 · open the first message on its own page

[PATCH] net: dsa: remove redundant null pointer check before put_device

From: zhong jiang <hidden>
Date: 2018-09-16 13:57:31

put_device has taken the null pinter check into account. So it is
safe to remove the duplicated check before put_device.

Signed-off-by: zhong jiang <redacted>
---
 net/dsa/legacy.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/net/dsa/legacy.c b/net/dsa/legacy.c
index 42a7b85..8aa92b0 100644
--- a/net/dsa/legacy.c
+++ b/net/dsa/legacy.c
@@ -392,8 +392,7 @@ static void dsa_of_free_platform_data(struct dsa_platform_data *pd)
 		}
 
 		/* Drop our reference to the MDIO bus device */
-		if (pd->chip[i].host_dev)
-			put_device(pd->chip[i].host_dev);
+		put_device(pd->chip[i].host_dev);
 	}
 	kfree(pd->chip);
 }
-- 
1.7.12.4

Re: [PATCH] net: dsa: remove redundant null pointer check before put_device

From: David Miller <davem@davemloft.net>
Date: 2018-09-17 15:21:06

From: zhong jiang <redacted>
Date: Sun, 16 Sep 2018 21:45:02 +0800
put_device has taken the null pinter check into account. So it is
safe to remove the duplicated check before put_device.

Signed-off-by: zhong jiang <redacted>
Applied.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help