[PATCH v2 13/13] leds: sgm3140: Put fwnode in any case during ->probe()
From: Andy Shevchenko
Date: Sat May 29 2021 - 07:20:24 EST
fwnode_get_next_child_node() bumps a reference counting of a returned variable.
We have to balance it whenever we return to the caller.
Fixes: cef8ec8cbd21 ("leds: add sgm3140 driver")
Cc: Luca Weiss <luca@xxxxxxxxx>
Signed-off-by: Andy Shevchenko <andy.shevchenko@xxxxxxxxx>
---
v2: no changes
drivers/leds/leds-sgm3140.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/drivers/leds/leds-sgm3140.c b/drivers/leds/leds-sgm3140.c
index f4f831570f11..df9402071695 100644
--- a/drivers/leds/leds-sgm3140.c
+++ b/drivers/leds/leds-sgm3140.c
@@ -266,12 +266,8 @@ static int sgm3140_probe(struct platform_device *pdev)
child_node,
fled_cdev, NULL,
&v4l2_sd_cfg);
- if (IS_ERR(priv->v4l2_flash)) {
- ret = PTR_ERR(priv->v4l2_flash);
- goto err;
- }
-
- return ret;
+ fwnode_handle_put(child_node);
+ return PTR_ERR_OR_ZERO(priv->v4l2_flash);
err:
fwnode_handle_put(child_node);
--
2.31.1