All of lore.kernel.org
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <krzk@kernel.org>
To: Manush Prajwal <manushprajwal555@gmail.com>,
	cw00.choi@samsung.com, lee@kernel.org, pavel@kernel.org
Cc: linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org,
	dsankouski@gmail.com, sakari.ailus@linux.intel.com
Subject: Re: [PATCH] leds: max77705: fix fwnode reference leak in max77705_add_led()
Date: Fri, 28 Aug 2026 10:56:31 +0200	[thread overview]
Message-ID: <6882b7d4-e0e6-4c83-8298-bc48abef5e76@kernel.org> (raw)
In-Reply-To: <6a914ad5.1e1ac41d.2a3f62.4979@mx.google.com>

On 28/08/2026 10:46, Manush Prajwal wrote:
> In the RGB LED path of max77705_add_led(), the
> fwnode_for_each_child_node() loop over the subled child nodes
> returns directly on a max77705_parse_subled() failure without
> releasing the reference held on the current child, since
> fwnode_for_each_child_node() is not a scoped/cleanup-based
> iterator and expects the caller to drop the reference itself on
> any early exit from the loop body.
> 
> Call fwnode_handle_put() on the child fwnode before returning to
> fix the leak.
> 
> Fixes: 3b6eaa3db567 ("leds: Use fwnode_for_each_child_node() instead")
> Signed-off-by: Manush Prajwal <manushprajwal555@gmail.com>
> ---
>  drivers/leds/leds-max77705.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/leds/leds-max77705.c b/drivers/leds/leds-max77705.c
> index 1e2054c..a5030c3 100644
> --- a/drivers/leds/leds-max77705.c
> +++ b/drivers/leds/leds-max77705.c
> @@ -193,8 +193,10 @@ static int max77705_add_led(struct device *dev, struct regmap *regmap, struct fw
> 
>  		fwnode_for_each_child_node(np, child) {

Would fwnode_for_each_child_node_scoped() work here?

>  			ret = max77705_parse_subled(dev, child, &info[i]);
> -			if (ret < 0)
> +			if (ret < 0) {
> +				fwnode_handle_put(child);
>  				return ret;
> +			}
> 
Best regards,
Krzysztof

  reply	other threads:[~2026-08-28  8:56 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-28  8:46 [PATCH] leds: max77705: fix fwnode reference leak in max77705_add_led() Manush Prajwal
2026-08-28  8:56 ` Krzysztof Kozlowski [this message]
2026-08-28  8:59 ` sashiko-bot
  -- strict thread matches above, loose matches on Subject: below --
2026-09-06 19:11 Miles Krause via B4 Relay
2026-09-06 19:11 ` Miles Krause
2026-09-17 13:25 ` Lee Jones

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6882b7d4-e0e6-4c83-8298-bc48abef5e76@kernel.org \
    --to=krzk@kernel.org \
    --cc=cw00.choi@samsung.com \
    --cc=dsankouski@gmail.com \
    --cc=lee@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=manushprajwal555@gmail.com \
    --cc=pavel@kernel.org \
    --cc=sakari.ailus@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.