aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/ibm
diff options
context:
space:
mode:
authorMarkus Elfring <elfring@users.sourceforge.net>2014-11-20 08:22:47 -0500
committerDavid S. Miller <davem@davemloft.net>2014-11-21 15:14:12 -0500
commit5ac0fd00e1681ef6f929f651124da77f5ca7e564 (patch)
tree1cd7f035de70ce9eeeb8c6645900618d6e01b9ef /drivers/net/ethernet/ibm
parent312df74c712252017f0c2c12289f00b146ca72b3 (diff)
IBM-EMAC: Deletion of unnecessary checks before the function call "of_dev_put"
The of_dev_put() function tests whether its argument is NULL and then returns immediately. Thus the test around the call is not needed. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/ibm')
-rw-r--r--drivers/net/ethernet/ibm/emac/core.c24
1 files changed, 8 insertions, 16 deletions
diff --git a/drivers/net/ethernet/ibm/emac/core.c b/drivers/net/ethernet/ibm/emac/core.c
index 87bd953cc2ee..3f3fba9e4650 100644
--- a/drivers/net/ethernet/ibm/emac/core.c
+++ b/drivers/net/ethernet/ibm/emac/core.c
@@ -2323,16 +2323,11 @@ static int emac_check_deps(struct emac_instance *dev,
2323 2323
2324static void emac_put_deps(struct emac_instance *dev) 2324static void emac_put_deps(struct emac_instance *dev)
2325{ 2325{
2326 if (dev->mal_dev) 2326 of_dev_put(dev->mal_dev);
2327 of_dev_put(dev->mal_dev); 2327 of_dev_put(dev->zmii_dev);
2328 if (dev->zmii_dev) 2328 of_dev_put(dev->rgmii_dev);
2329 of_dev_put(dev->zmii_dev); 2329 of_dev_put(dev->mdio_dev);
2330 if (dev->rgmii_dev) 2330 of_dev_put(dev->tah_dev);
2331 of_dev_put(dev->rgmii_dev);
2332 if (dev->mdio_dev)
2333 of_dev_put(dev->mdio_dev);
2334 if (dev->tah_dev)
2335 of_dev_put(dev->tah_dev);
2336} 2331}
2337 2332
2338static int emac_of_bus_notify(struct notifier_block *nb, unsigned long action, 2333static int emac_of_bus_notify(struct notifier_block *nb, unsigned long action,
@@ -2371,8 +2366,7 @@ static int emac_wait_deps(struct emac_instance *dev)
2371 bus_unregister_notifier(&platform_bus_type, &emac_of_bus_notifier); 2366 bus_unregister_notifier(&platform_bus_type, &emac_of_bus_notifier);
2372 err = emac_check_deps(dev, deps) ? 0 : -ENODEV; 2367 err = emac_check_deps(dev, deps) ? 0 : -ENODEV;
2373 for (i = 0; i < EMAC_DEP_COUNT; i++) { 2368 for (i = 0; i < EMAC_DEP_COUNT; i++) {
2374 if (deps[i].node) 2369 of_node_put(deps[i].node);
2375 of_node_put(deps[i].node);
2376 if (err && deps[i].ofdev) 2370 if (err && deps[i].ofdev)
2377 of_dev_put(deps[i].ofdev); 2371 of_dev_put(deps[i].ofdev);
2378 } 2372 }
@@ -2383,8 +2377,7 @@ static int emac_wait_deps(struct emac_instance *dev)
2383 dev->tah_dev = deps[EMAC_DEP_TAH_IDX].ofdev; 2377 dev->tah_dev = deps[EMAC_DEP_TAH_IDX].ofdev;
2384 dev->mdio_dev = deps[EMAC_DEP_MDIO_IDX].ofdev; 2378 dev->mdio_dev = deps[EMAC_DEP_MDIO_IDX].ofdev;
2385 } 2379 }
2386 if (deps[EMAC_DEP_PREV_IDX].ofdev) 2380 of_dev_put(deps[EMAC_DEP_PREV_IDX].ofdev);
2387 of_dev_put(deps[EMAC_DEP_PREV_IDX].ofdev);
2388 return err; 2381 return err;
2389} 2382}
2390 2383
@@ -3113,8 +3106,7 @@ static void __exit emac_exit(void)
3113 3106
3114 /* Destroy EMAC boot list */ 3107 /* Destroy EMAC boot list */
3115 for (i = 0; i < EMAC_BOOT_LIST_SIZE; i++) 3108 for (i = 0; i < EMAC_BOOT_LIST_SIZE; i++)
3116 if (emac_boot_list[i]) 3109 of_node_put(emac_boot_list[i]);
3117 of_node_put(emac_boot_list[i]);
3118} 3110}
3119 3111
3120module_init(emac_init); 3112module_init(emac_init);