Skip to content

Commit 76b7f8f

Browse files
andy-shevlinusw
authored andcommitted
pinctrl: microchip-sgpio: Put fwnode in error case during ->probe()
device_for_each_child_node() bumps a reference counting of a returned variable. We have to balance it whenever we return to the caller. Fixes: 7e5ea97 ("pinctrl: pinctrl-microchip-sgpio: Add pinctrl driver for Microsemi Serial GPIO") Cc: Lars Povlsen <[email protected]> Signed-off-by: Andy Shevchenko <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Linus Walleij <[email protected]>
1 parent 009c9aa commit 76b7f8f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/pinctrl/pinctrl-microchip-sgpio.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -845,8 +845,10 @@ static int microchip_sgpio_probe(struct platform_device *pdev)
845845
i = 0;
846846
device_for_each_child_node(dev, fwnode) {
847847
ret = microchip_sgpio_register_bank(dev, priv, fwnode, i++);
848-
if (ret)
848+
if (ret) {
849+
fwnode_handle_put(fwnode);
849850
return ret;
851+
}
850852
}
851853

852854
if (priv->in.gpio.ngpio != priv->out.gpio.ngpio) {

0 commit comments

Comments
 (0)