All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sebastian Reichel <sebastian.reichel@collabora.com>
To: Tian Xuechen <202300460064@mail.sdu.edu.cn>
Cc: nikita.shubin@maquefel.me, arnd@arndb.de, vkoul@kernel.org,
	 linux@roeck-us.net, alexandre.belloni@bootlin.com, fkan@apm.com,
	 linux-pm@vger.kernel.org, liguangshuo@mail.sdu.edu.cn
Subject: Re: [PATCH 4/4] power: reset: syscon-reboot: Unregister the restart handler on removal
Date: Sat, 5 Dec 2026 23:58:31 +0100	[thread overview]
Message-ID: <axSW-BDBRiS0MNnB@venus> (raw)
In-Reply-To: <20261129094744.1691778-5-202300460064@mail.sdu.edu.cn>

[-- Attachment #1: Type: text/plain, Size: 1842 bytes --]

Hi,

On Sun, Nov 29, 2026 at 05:47:44PM +0800, Tian Xuechen wrote:
> From: Tian Xuechen <202300460064@mail.sdu.edu.cn>
> 
> The restart notifier remains registered after devres releases its
> driver data. Arrange for the device to unregister the notifier
> before that storage goes away.
> 
> This issue was found by our static analysis tool under development.
> 
> Fixes: 09fb07bcaf52 ("power: reset: Add generic SYSCON register mapped reset")
> Signed-off-by: Tian Xuechen <202300460064@mail.sdu.edu.cn>
> ---
>  drivers/power/reset/syscon-reboot.c | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/power/reset/syscon-reboot.c b/drivers/power/reset/syscon-reboot.c
> index 3b0a20a2729f..9eae99ad2b2a 100644
> --- a/drivers/power/reset/syscon-reboot.c
> +++ b/drivers/power/reset/syscon-reboot.c
> @@ -63,6 +63,11 @@ static int syscon_restart_handle(struct notifier_block *this,
>  	return NOTIFY_DONE;
>  }
>  
> +static void syscon_reboot_unregister(void *data)
> +{
> +	unregister_restart_handler(data);
> +}
> +
>  static int syscon_reboot_probe(struct platform_device *pdev)
>  {
>  	struct syscon_reboot_context *ctx;
> @@ -117,9 +122,10 @@ static int syscon_reboot_probe(struct platform_device *pdev)
>  	ctx->restart_handler.priority = priority;
>  	err = register_restart_handler(&ctx->restart_handler);

devm_register_sys_off_handler()

Greetings,

-- Sebastian

>  	if (err)
> -		dev_err(dev, "can't register restart notifier (err=%d)\n", err);
> +		return dev_err_probe(dev, err, "cannot register restart notifier\n");
>  
> -	return err;
> +	return devm_add_action_or_reset(dev, syscon_reboot_unregister,
> +					&ctx->restart_handler);
>  }
>  
>  static const struct reboot_data gs101_reboot_data = {
> 
> -- 
> 2.43.0
> 
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

      reply	other threads:[~2026-12-05 22:59 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-29  9:47 [PATCH 0/4] power: reset: Unregister restart handlers on removal Tian Xuechen
2026-11-29  9:47 ` [PATCH 1/4] power: reset: ep93xx: Unregister the restart handler " Tian Xuechen
2026-12-05 22:57   ` Sebastian Reichel
2026-11-29  9:47 ` [PATCH 2/4] power: reset: hisi: Unregister the restart handler on unbind Tian Xuechen
2026-12-05 22:56   ` Sebastian Reichel
2026-11-29  9:47 ` [PATCH 3/4] power: reset: ocelot: Unregister the restart handler on removal Tian Xuechen
2026-12-05 22:57   ` Sebastian Reichel
2026-11-29  9:47 ` [PATCH 4/4] power: reset: syscon-reboot: " Tian Xuechen
2026-12-05 22:58   ` Sebastian Reichel [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=axSW-BDBRiS0MNnB@venus \
    --to=sebastian.reichel@collabora.com \
    --cc=202300460064@mail.sdu.edu.cn \
    --cc=alexandre.belloni@bootlin.com \
    --cc=arnd@arndb.de \
    --cc=fkan@apm.com \
    --cc=liguangshuo@mail.sdu.edu.cn \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=nikita.shubin@maquefel.me \
    --cc=vkoul@kernel.org \
    /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.