net: dsa: remove redundant null pointer check before put_device
authorzhong jiang <zhongjiang@huawei.com>
Sun, 16 Sep 2018 13:45:02 +0000 (21:45 +0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 17 Sep 2018 15:20:11 +0000 (08:20 -0700)
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 <zhongjiang@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/dsa/legacy.c

index 42a7b85b84e1f66e83387867e6a3eea750647277..8aa92b09db766ca75091443370a484d4cec87b3b 100644 (file)
@@ -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);
 }