From: Lee Jones <lee@kernel.org>
To: Heiner Kallweit <hkallweit1@gmail.com>
Cc: Pavel Machek <pavel@ucw.cz>,
"linux-leds@vger.kernel.org" <linux-leds@vger.kernel.org>
Subject: Re: [PATCH] leds: trigger: panic: don't register panic notifier if creating the trigger failed
Date: Wed, 13 Dec 2023 16:00:01 +0000 [thread overview]
Message-ID: <20231213160001.GP111411@google.com> (raw)
In-Reply-To: <c8aa079f-acf7-4cb8-b198-d16fcc5778c3@gmail.com>
On Sat, 09 Dec 2023, Heiner Kallweit wrote:
> It doesn't make sense to register the panic notifier if creating the
> panic trigger failed.
>
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
> ---
> drivers/leds/trigger/ledtrig-panic.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/leds/trigger/ledtrig-panic.c b/drivers/leds/trigger/ledtrig-panic.c
> index 64abf2e91..72297a845 100644
> --- a/drivers/leds/trigger/ledtrig-panic.c
> +++ b/drivers/leds/trigger/ledtrig-panic.c
> @@ -64,10 +64,13 @@ static long led_panic_blink(int state)
>
> static int __init ledtrig_panic_init(void)
> {
> + led_trigger_register_simple("panic", &trigger);
> + if (!trigger)
> + return 0;
It doesn't seem correct to return 0 on a known failure.
> +
> atomic_notifier_chain_register(&panic_notifier_list,
> &led_trigger_panic_nb);
>
> - led_trigger_register_simple("panic", &trigger);
> panic_blink = led_panic_blink;
> return 0;
> }
> --
> 2.43.0
>
--
Lee Jones [李琼斯]
prev parent reply other threads:[~2023-12-13 16:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-09 22:51 [PATCH] leds: trigger: panic: don't register panic notifier if creating the trigger failed Heiner Kallweit
2023-12-13 16:00 ` Lee Jones [this message]
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=20231213160001.GP111411@google.com \
--to=lee@kernel.org \
--cc=hkallweit1@gmail.com \
--cc=linux-leds@vger.kernel.org \
--cc=pavel@ucw.cz \
/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.