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 3/4] power: reset: ocelot: Unregister the restart handler on removal
Date: Sat, 5 Dec 2026 23:57:44 +0100	[thread overview]
Message-ID: <axSWzWBdtNS1sV9p@venus> (raw)
In-Reply-To: <20261129094744.1691778-4-202300460064@mail.sdu.edu.cn>

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

Hi,

On Sun, Nov 29, 2026 at 05:47:43PM +0800, Tian Xuechen wrote:
> From: Tian Xuechen <202300460064@mail.sdu.edu.cn>
> 
> The restart handler is embedded in the device-managed reset context.
> Unregister it on removal so the restart notifier chain no longer
> references the context when devres frees it.
> 
> This issue was found by our static analysis tool under development.
> 
> Fixes: 6ab739bc1d00 ("power: reset: Add a driver for the Microsemi Ocelot reset")
> Signed-off-by: Tian Xuechen <202300460064@mail.sdu.edu.cn>
> ---

I queued a different fix, which was sent before this one.

Greetings,

-- Sebastian

>  drivers/power/reset/ocelot-reset.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/drivers/power/reset/ocelot-reset.c b/drivers/power/reset/ocelot-reset.c
> index 0acfa63b6b5d..4f0010994940 100644
> --- a/drivers/power/reset/ocelot-reset.c
> +++ b/drivers/power/reset/ocelot-reset.c
> @@ -87,6 +87,7 @@ static int ocelot_reset_probe(struct platform_device *pdev)
>  		return PTR_ERR(ctx->cpu_ctrl);
>  	}
>  
> +	platform_set_drvdata(pdev, ctx);
>  	ctx->restart_handler.notifier_call = ocelot_restart_handle;
>  	ctx->restart_handler.priority = 192;
>  	err = register_restart_handler(&ctx->restart_handler);
> @@ -96,6 +97,13 @@ static int ocelot_reset_probe(struct platform_device *pdev)
>  	return err;
>  }
>  
> +static void ocelot_reset_remove(struct platform_device *pdev)
> +{
> +	struct ocelot_reset_context *ctx = platform_get_drvdata(pdev);
> +
> +	unregister_restart_handler(&ctx->restart_handler);
> +}
> +
>  static const struct reset_props reset_props_jaguar2 = {
>  	.syscon		 = "mscc,ocelot-cpu-syscon",
>  	.protect_reg     = 0x20,
> @@ -143,6 +151,7 @@ static const struct of_device_id ocelot_reset_of_match[] = {
>  
>  static struct platform_driver ocelot_reset_driver = {
>  	.probe = ocelot_reset_probe,
> +	.remove = ocelot_reset_remove,
>  	.driver = {
>  		.name = "ocelot-chip-reset",
>  		.of_match_table = ocelot_reset_of_match,
> 
> -- 
> 2.43.0
> 
> 

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

  reply	other threads:[~2026-12-05 22:58 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 [this message]
2026-11-29  9:47 ` [PATCH 4/4] power: reset: syscon-reboot: " Tian Xuechen
2026-12-05 22:58   ` Sebastian Reichel

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=axSWzWBdtNS1sV9p@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.