fsl/fman: Add a missing 'of_node_put()' call in an error handling path
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Mon, 6 Nov 2017 21:53:31 +0000 (22:53 +0100)
committerDavid S. Miller <davem@davemloft.net>
Wed, 8 Nov 2017 04:53:33 +0000 (13:53 +0900)
If 'of_phy_find_device()' fails, we must undo the previous 'of_node_get()'
call, as done the the following error handling code.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/freescale/fman/mac.c

index ca12e28129ed5309a8b4ecb2f0687f5fb1d98991..86c1e69f44d6cdee1f5e94fc2117b95e1ca6ac9f 100644 (file)
@@ -821,6 +821,7 @@ static int mac_probe(struct platform_device *_of_dev)
                phy = of_phy_find_device(mac_dev->phy_node);
                if (!phy) {
                        err = -EINVAL;
+                       of_node_put(mac_dev->phy_node);
                        goto _return_of_get_parent;
                }