net: fec: free/restore resource in related probe error pathes
authorFugang Duan <fugang.duan@nxp.com>
Thu, 4 Jan 2018 02:47:20 +0000 (10:47 +0800)
committerDavid S. Miller <davem@davemloft.net>
Fri, 5 Jan 2018 16:19:11 +0000 (11:19 -0500)
Fixes in probe error path:
- Restore dev_id before failed_ioremap path.
Fixes: ("net: fec: restore dev_id in the cases of probe error")
- Call of_node_put(phy_node) before failed_phy path.
Fixes: ("net: fec: Support phys probed from devicetree and fixed-link")
Signed-off-by: Fugang Duan <fugang.duan@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/freescale/fec_main.c

index 19f198e22e1544a80c5970f55c47acb66993ee10..a74300a4459c78d7797cff90962a1a7a394dccb5 100644 (file)
@@ -3556,11 +3556,11 @@ failed_clk_ipg:
 failed_clk:
        if (of_phy_is_fixed_link(np))
                of_phy_deregister_fixed_link(np);
-failed_phy:
        of_node_put(phy_node);
+failed_phy:
+       dev_id--;
 failed_ioremap:
        free_netdev(ndev);
-       dev_id--;
 
        return ret;
 }