[PATCH v1 28/28] leds: sgm3140: Put fwnode in any case during ->probe()
From: Andy Shevchenko
Date: Mon May 10 2021 - 05:53:35 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>
---
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