Skip to content

Commit

Permalink
net: dsa: sja1105: Add of_node_put() before return
Browse files Browse the repository at this point in the history
Fix following coccicheck warning:
./drivers/net/dsa/sja1105/sja1105_main.c:1193:1-33: WARNING: Function
for_each_available_child_of_node should have of_node_put() before return.

Early exits from for_each_available_child_of_node should decrement the
node reference counter.

Fixes: 9ca482a ("net: dsa: sja1105: parse {rx, tx}-internal-delay-ps properties for RGMII delays")
Signed-off-by: Wan Jiabing <wanjiabing@vivo.com>
Link: https://lore.kernel.org/r/20211021094606.7118-1-wanjiabing@vivo.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Wan Jiabing authored and Jakub Kicinski committed Oct 22, 2021
1 parent 47b0682 commit f3956e3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/net/dsa/sja1105/sja1105_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1233,8 +1233,10 @@ static int sja1105_parse_ports_node(struct sja1105_private *priv,
priv->phy_mode[index] = phy_mode;

err = sja1105_parse_rgmii_delays(priv, index, child);
if (err)
if (err) {
of_node_put(child);
return err;
}
}

return 0;
Expand Down

0 comments on commit f3956e3

Please sign in to comment.