]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
IBM-EMAC: Deletion of unnecessary checks before the function call "of_dev_put"
authorMarkus Elfring <elfring@users.sourceforge.net>
Thu, 20 Nov 2014 13:22:47 +0000 (14:22 +0100)
committerDavid S. Miller <davem@davemloft.net>
Fri, 21 Nov 2014 20:14:12 +0000 (15:14 -0500)
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>
drivers/net/ethernet/ibm/emac/core.c

index 87bd953cc2eeaef7f6af65902841645e98f7eda5..3f3fba9e465076220ba2a3644e8f240bbf5dda0a 100644 (file)
@@ -2323,16 +2323,11 @@ static int emac_check_deps(struct emac_instance *dev,
 
 static void emac_put_deps(struct emac_instance *dev)
 {
-       if (dev->mal_dev)
-               of_dev_put(dev->mal_dev);
-       if (dev->zmii_dev)
-               of_dev_put(dev->zmii_dev);
-       if (dev->rgmii_dev)
-               of_dev_put(dev->rgmii_dev);
-       if (dev->mdio_dev)
-               of_dev_put(dev->mdio_dev);
-       if (dev->tah_dev)
-               of_dev_put(dev->tah_dev);
+       of_dev_put(dev->mal_dev);
+       of_dev_put(dev->zmii_dev);
+       of_dev_put(dev->rgmii_dev);
+       of_dev_put(dev->mdio_dev);
+       of_dev_put(dev->tah_dev);
 }
 
 static 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)
        bus_unregister_notifier(&platform_bus_type, &emac_of_bus_notifier);
        err = emac_check_deps(dev, deps) ? 0 : -ENODEV;
        for (i = 0; i < EMAC_DEP_COUNT; i++) {
-               if (deps[i].node)
-                       of_node_put(deps[i].node);
+               of_node_put(deps[i].node);
                if (err && deps[i].ofdev)
                        of_dev_put(deps[i].ofdev);
        }
@@ -2383,8 +2377,7 @@ static int emac_wait_deps(struct emac_instance *dev)
                dev->tah_dev = deps[EMAC_DEP_TAH_IDX].ofdev;
                dev->mdio_dev = deps[EMAC_DEP_MDIO_IDX].ofdev;
        }
-       if (deps[EMAC_DEP_PREV_IDX].ofdev)
-               of_dev_put(deps[EMAC_DEP_PREV_IDX].ofdev);
+       of_dev_put(deps[EMAC_DEP_PREV_IDX].ofdev);
        return err;
 }
 
@@ -3113,8 +3106,7 @@ static void __exit emac_exit(void)
 
        /* Destroy EMAC boot list */
        for (i = 0; i < EMAC_BOOT_LIST_SIZE; i++)
-               if (emac_boot_list[i])
-                       of_node_put(emac_boot_list[i]);
+               of_node_put(emac_boot_list[i]);
 }
 
 module_init(emac_init);