lkml.org 
[lkml]   [2021]   [May]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v2 13/13] leds: sgm3140: Put fwnode in any case during ->probe()
Date
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@z3ntu.xyz>
Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---
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
\
 
 \ /
  Last update: 2021-05-29 13:21    [W:0.149 / U:0.024 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site