]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
stmmac: add missing of_node_put
authorJulia Lawall <julia.lawall@lip6.fr>
Tue, 17 Jan 2017 11:23:21 +0000 (12:23 +0100)
committerDavid S. Miller <davem@davemloft.net>
Tue, 17 Jan 2017 19:10:35 +0000 (14:10 -0500)
The function stmmac_dt_phy provides several possibilities for initializing
plat->mdio_node, all of which have the effect of increasing the reference
count of the assigned value.  This field is not updated elsewhere, so the
value is live until the end of the lifetime of plat (devm_allocated), just
after the end of stmmac_remove_config_dt.  Thus, add an of_node_put on
plat->mdio_node in stmmac_remove_config_dt.  It is possible that the field
mdio_node is never initialized, but of_node_put is NULL-safe, so it is also
safe to call of_node_put in that case.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Acked-by: Alexandre TORGUE <alexandre.torgue@st.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c

index 082cd48db6a769b43507be7442ca6d9ff0099c5f..36942f5a6a53adfc20bd254b0045fad51e398c12 100644 (file)
@@ -351,6 +351,7 @@ void stmmac_remove_config_dt(struct platform_device *pdev,
        if (of_phy_is_fixed_link(np))
                of_phy_deregister_fixed_link(np);
        of_node_put(plat->phy_node);
+       of_node_put(plat->mdio_node);
 }
 #else
 struct plat_stmmacenet_data *