mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andy Shevchenko <andy@kernel.org>
To: Markus Elfring <Markus.Elfring@web.de>
Cc: kernel-janitors@vger.kernel.org,
	"Geert Uytterhoeven" <geert@linux-m68k.org>,
	"Marek Behún" <kabel@kernel.org>,
	"Miguel Ojeda" <ojeda@kernel.org>,
	"Robin van der Gracht" <robin@protonic.nl>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] auxdisplay: ht16k33: Drop device node reference after registration failure in ht16k33_led_probe()
Date: Tue, 4 Jun 2024 19:33:31 +0300	[thread overview]
Message-ID: <Zl9B2zqbJqVAf83d@smile.fi.intel.com> (raw)
In-Reply-To: <0fc79fe9-da49-4cbe-a7ff-6443ad93f120@web.de>

On Tue, Jun 04, 2024 at 05:15:37PM +0200, Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Tue, 4 Jun 2024 17:02:15 +0200
> 
> A failed call of the function “devm_led_classdev_register_ext”
> can be reported.
> Add a call of the function “fwnode_handle_put” for this error case.

Replace double quotes by parentheses, so the reference to the functions
will look like func().

...

>  	err = devm_led_classdev_register_ext(dev, led, &init_data);
> -	if (err)
> +	if (err) {
>  		dev_err(dev, "Failed to register LED\n");
> +		fwnode_handle_put(init_data.fwnode);
> +	}

There are two issues with this approach:
1) there is the same issue in ->remove(), isn't it?
2) it potentially might mess up the ordering if any other devm call happens
   in beetween.

But, by design we don't use reference counting after we registered LED, hence
both error and successful paths need to have this, so add another
fwnode_handle_put() after this branch.

-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2024-06-04 16:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-04 15:15 Markus Elfring
2024-06-04 16:33 ` Andy Shevchenko [this message]
2024-06-04 18:15   ` Markus Elfring
2024-06-04 19:30     ` Andy Shevchenko

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=Zl9B2zqbJqVAf83d@smile.fi.intel.com \
    --to=andy@kernel.org \
    --cc=Markus.Elfring@web.de \
    --cc=geert@linux-m68k.org \
    --cc=kabel@kernel.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ojeda@kernel.org \
    --cc=robin@protonic.nl \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome