* [PATCH 0/4] power: reset: Unregister restart handlers on removal
@ 2026-11-29 9:47 Tian Xuechen
2026-11-29 9:47 ` [PATCH 1/4] power: reset: ep93xx: Unregister the restart handler " Tian Xuechen
` (3 more replies)
0 siblings, 4 replies; 9+ messages in thread
From: Tian Xuechen @ 2026-11-29 9:47 UTC (permalink / raw)
To: sre, nikita.shubin, arnd, vkoul, linux, alexandre.belloni, fkan
Cc: linux-pm, liguangshuo
From: Tian Xuechen <202300460064@mail.sdu.edu.cn>
Pair restart handler registration with teardown in the EP93xx,
HiSilicon, Ocelot and syscon-reboot drivers.
Tian Xuechen (4):
power: reset: ep93xx: Unregister the restart handler on removal
power: reset: hisi: Unregister the restart handler on unbind
power: reset: ocelot: Unregister the restart handler on removal
power: reset: syscon-reboot: Unregister the restart handler on removal
base-commit: 4dce97c6c265544342e716e62fd24bbb232590c5
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/4] power: reset: ep93xx: Unregister the restart handler on removal
2026-11-29 9:47 [PATCH 0/4] power: reset: Unregister restart handlers on removal Tian Xuechen
@ 2026-11-29 9:47 ` 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
` (2 subsequent siblings)
3 siblings, 1 reply; 9+ messages in thread
From: Tian Xuechen @ 2026-11-29 9:47 UTC (permalink / raw)
To: sre, nikita.shubin, arnd, vkoul, linux, alexandre.belloni, fkan
Cc: linux-pm, liguangshuo
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: 9fa7cdb4368f ("power: reset: Add a driver for the ep93xx reset")
Signed-off-by: Tian Xuechen <202300460064@mail.sdu.edu.cn>
---
drivers/power/reset/ep93xx-restart.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/power/reset/ep93xx-restart.c b/drivers/power/reset/ep93xx-restart.c
index 46415a3071e7..a65c84e4e5a7 100644
--- a/drivers/power/reset/ep93xx-restart.c
+++ b/drivers/power/reset/ep93xx-restart.c
@@ -41,6 +41,11 @@ static int ep93xx_restart_handle(struct notifier_block *this,
return NOTIFY_DONE;
}
+static void ep93xx_reboot_unregister(void *data)
+{
+ unregister_restart_handler(data);
+}
+
static int ep93xx_reboot_probe(struct auxiliary_device *adev,
const struct auxiliary_device_id *id)
{
@@ -65,7 +70,8 @@ static int ep93xx_reboot_probe(struct auxiliary_device *adev,
if (err)
return dev_err_probe(dev, err, "can't register restart notifier\n");
- return 0;
+ return devm_add_action_or_reset(dev, ep93xx_reboot_unregister,
+ &priv->restart_handler);
}
static const struct auxiliary_device_id ep93xx_reboot_ids[] = {
--
2.43.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 2/4] power: reset: hisi: Unregister the restart handler on unbind
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-11-29 9:47 ` 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-11-29 9:47 ` [PATCH 4/4] power: reset: syscon-reboot: " Tian Xuechen
3 siblings, 1 reply; 9+ messages in thread
From: Tian Xuechen @ 2026-11-29 9:47 UTC (permalink / raw)
To: sre, nikita.shubin, arnd, vkoul, linux, alexandre.belloni, fkan
Cc: linux-pm, liguangshuo
From: Tian Xuechen <202300460064@mail.sdu.edu.cn>
Removing the driver leaves its restart handler registered and the
register mapping in use. Keep both in per-device data, unregister the
handler on removal, then unmap its registers.
This issue was found by our static analysis tool under development.
Fixes: 6724534c79ea ("power/reset: hisi: Register with kernel restart handler")
Signed-off-by: Tian Xuechen <202300460064@mail.sdu.edu.cn>
---
drivers/power/reset/hisi-reboot.c | 46 +++++++++++++++++++++----------
1 file changed, 32 insertions(+), 14 deletions(-)
diff --git a/drivers/power/reset/hisi-reboot.c b/drivers/power/reset/hisi-reboot.c
index 34409340528f..e106e9f0acaf 100644
--- a/drivers/power/reset/hisi-reboot.c
+++ b/drivers/power/reset/hisi-reboot.c
@@ -15,16 +15,22 @@
#include <linux/of_address.h>
#include <linux/platform_device.h>
#include <linux/reboot.h>
+#include <linux/slab.h>
#include <asm/proc-fns.h>
-static void __iomem *base;
-static u32 reboot_offset;
+struct hisi_reboot {
+ struct notifier_block nb;
+ void __iomem *base;
+ u32 offset;
+};
static int hisi_restart_handler(struct notifier_block *this,
unsigned long mode, void *cmd)
{
- writel_relaxed(0xdeadbeef, base + reboot_offset);
+ struct hisi_reboot *reboot = container_of(this, struct hisi_reboot, nb);
+
+ writel_relaxed(0xdeadbeef, reboot->base + reboot->offset);
while (1)
cpu_do_idle();
@@ -32,38 +38,49 @@ static int hisi_restart_handler(struct notifier_block *this,
return NOTIFY_DONE;
}
-static struct notifier_block hisi_restart_nb = {
- .notifier_call = hisi_restart_handler,
- .priority = 128,
-};
-
static int hisi_reboot_probe(struct platform_device *pdev)
{
struct device_node *np = pdev->dev.of_node;
+ struct hisi_reboot *reboot;
int err;
- base = of_iomap(np, 0);
- if (!base) {
+ reboot = devm_kzalloc(&pdev->dev, sizeof(*reboot), GFP_KERNEL);
+ if (!reboot)
+ return -ENOMEM;
+
+ reboot->base = of_iomap(np, 0);
+ if (!reboot->base) {
WARN(1, "failed to map base address");
return -ENODEV;
}
- if (of_property_read_u32(np, "reboot-offset", &reboot_offset) < 0) {
+ if (of_property_read_u32(np, "reboot-offset", &reboot->offset) < 0) {
pr_err("failed to find reboot-offset property\n");
- iounmap(base);
+ iounmap(reboot->base);
return -EINVAL;
}
- err = register_restart_handler(&hisi_restart_nb);
+ platform_set_drvdata(pdev, reboot);
+ reboot->nb.notifier_call = hisi_restart_handler;
+ reboot->nb.priority = 128;
+ err = register_restart_handler(&reboot->nb);
if (err) {
dev_err(&pdev->dev, "cannot register restart handler (err=%d)\n",
err);
- iounmap(base);
+ iounmap(reboot->base);
}
return err;
}
+static void hisi_reboot_remove(struct platform_device *pdev)
+{
+ struct hisi_reboot *reboot = platform_get_drvdata(pdev);
+
+ unregister_restart_handler(&reboot->nb);
+ iounmap(reboot->base);
+}
+
static const struct of_device_id hisi_reboot_of_match[] = {
{ .compatible = "hisilicon,sysctrl" },
{}
@@ -72,6 +89,7 @@ MODULE_DEVICE_TABLE(of, hisi_reboot_of_match);
static struct platform_driver hisi_reboot_driver = {
.probe = hisi_reboot_probe,
+ .remove = hisi_reboot_remove,
.driver = {
.name = "hisi-reboot",
.of_match_table = hisi_reboot_of_match,
--
2.43.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 3/4] power: reset: ocelot: Unregister the restart handler on removal
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-11-29 9:47 ` [PATCH 2/4] power: reset: hisi: Unregister the restart handler on unbind Tian Xuechen
@ 2026-11-29 9:47 ` Tian Xuechen
2026-12-05 22:57 ` Sebastian Reichel
2026-11-29 9:47 ` [PATCH 4/4] power: reset: syscon-reboot: " Tian Xuechen
3 siblings, 1 reply; 9+ messages in thread
From: Tian Xuechen @ 2026-11-29 9:47 UTC (permalink / raw)
To: sre, nikita.shubin, arnd, vkoul, linux, alexandre.belloni, fkan
Cc: linux-pm, liguangshuo
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>
---
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
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 4/4] power: reset: syscon-reboot: Unregister the restart handler on removal
2026-11-29 9:47 [PATCH 0/4] power: reset: Unregister restart handlers on removal Tian Xuechen
` (2 preceding siblings ...)
2026-11-29 9:47 ` [PATCH 3/4] power: reset: ocelot: Unregister the restart handler on removal Tian Xuechen
@ 2026-11-29 9:47 ` Tian Xuechen
2026-12-05 22:58 ` Sebastian Reichel
3 siblings, 1 reply; 9+ messages in thread
From: Tian Xuechen @ 2026-11-29 9:47 UTC (permalink / raw)
To: sre, nikita.shubin, arnd, vkoul, linux, alexandre.belloni, fkan
Cc: linux-pm, liguangshuo
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);
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
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 2/4] power: reset: hisi: Unregister the restart handler on unbind
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
0 siblings, 0 replies; 9+ messages in thread
From: Sebastian Reichel @ 2026-12-05 22:56 UTC (permalink / raw)
To: Tian Xuechen
Cc: nikita.shubin, arnd, vkoul, linux, alexandre.belloni, fkan,
linux-pm, liguangshuo
[-- Attachment #1: Type: text/plain, Size: 3786 bytes --]
Hi,
On Sun, Nov 29, 2026 at 05:47:42PM +0800, Tian Xuechen wrote:
> From: Tian Xuechen <202300460064@mail.sdu.edu.cn>
>
> Removing the driver leaves its restart handler registered and the
> register mapping in use. Keep both in per-device data, unregister the
> handler on removal, then unmap its registers.
>
> This issue was found by our static analysis tool under development.
>
> Fixes: 6724534c79ea ("power/reset: hisi: Register with kernel restart handler")
> Signed-off-by: Tian Xuechen <202300460064@mail.sdu.edu.cn>
> ---
> drivers/power/reset/hisi-reboot.c | 46 +++++++++++++++++++++----------
> 1 file changed, 32 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/power/reset/hisi-reboot.c b/drivers/power/reset/hisi-reboot.c
> index 34409340528f..e106e9f0acaf 100644
> --- a/drivers/power/reset/hisi-reboot.c
> +++ b/drivers/power/reset/hisi-reboot.c
> @@ -15,16 +15,22 @@
> #include <linux/of_address.h>
> #include <linux/platform_device.h>
> #include <linux/reboot.h>
> +#include <linux/slab.h>
>
> #include <asm/proc-fns.h>
>
> -static void __iomem *base;
> -static u32 reboot_offset;
> +struct hisi_reboot {
> + struct notifier_block nb;
> + void __iomem *base;
> + u32 offset;
> +};
>
> static int hisi_restart_handler(struct notifier_block *this,
> unsigned long mode, void *cmd)
> {
> - writel_relaxed(0xdeadbeef, base + reboot_offset);
> + struct hisi_reboot *reboot = container_of(this, struct hisi_reboot, nb);
> +
> + writel_relaxed(0xdeadbeef, reboot->base + reboot->offset);
>
> while (1)
> cpu_do_idle();
> @@ -32,38 +38,49 @@ static int hisi_restart_handler(struct notifier_block *this,
> return NOTIFY_DONE;
> }
>
> -static struct notifier_block hisi_restart_nb = {
> - .notifier_call = hisi_restart_handler,
> - .priority = 128,
> -};
> -
> static int hisi_reboot_probe(struct platform_device *pdev)
> {
> struct device_node *np = pdev->dev.of_node;
> + struct hisi_reboot *reboot;
> int err;
>
> - base = of_iomap(np, 0);
> - if (!base) {
> + reboot = devm_kzalloc(&pdev->dev, sizeof(*reboot), GFP_KERNEL);
> + if (!reboot)
> + return -ENOMEM;
> +
> + reboot->base = of_iomap(np, 0);
devm_platform_ioremap_resource()
> + if (!reboot->base) {
> WARN(1, "failed to map base address");
> return -ENODEV;
> }
>
> - if (of_property_read_u32(np, "reboot-offset", &reboot_offset) < 0) {
> + if (of_property_read_u32(np, "reboot-offset", &reboot->offset) < 0) {
> pr_err("failed to find reboot-offset property\n");
> - iounmap(base);
> + iounmap(reboot->base);
> return -EINVAL;
> }
>
> - err = register_restart_handler(&hisi_restart_nb);
> + platform_set_drvdata(pdev, reboot);
> + reboot->nb.notifier_call = hisi_restart_handler;
> + reboot->nb.priority = 128;
> + err = register_restart_handler(&reboot->nb);
devm_register_sys_off_handler()
> if (err) {
> dev_err(&pdev->dev, "cannot register restart handler (err=%d)\n",
> err);
> - iounmap(base);
> + iounmap(reboot->base);
> }
>
> return err;
> }
>
> +static void hisi_reboot_remove(struct platform_device *pdev)
> +{
> + struct hisi_reboot *reboot = platform_get_drvdata(pdev);
> +
> + unregister_restart_handler(&reboot->nb);
> + iounmap(reboot->base);
> +}
> +
> static const struct of_device_id hisi_reboot_of_match[] = {
> { .compatible = "hisilicon,sysctrl" },
> {}
> @@ -72,6 +89,7 @@ MODULE_DEVICE_TABLE(of, hisi_reboot_of_match);
>
> static struct platform_driver hisi_reboot_driver = {
> .probe = hisi_reboot_probe,
> + .remove = hisi_reboot_remove,
> .driver = {
> .name = "hisi-reboot",
> .of_match_table = hisi_reboot_of_match,
Greetings,
-- Sebastian
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/4] power: reset: ep93xx: Unregister the restart handler on removal
2026-11-29 9:47 ` [PATCH 1/4] power: reset: ep93xx: Unregister the restart handler " Tian Xuechen
@ 2026-12-05 22:57 ` Sebastian Reichel
0 siblings, 0 replies; 9+ messages in thread
From: Sebastian Reichel @ 2026-12-05 22:57 UTC (permalink / raw)
To: Tian Xuechen
Cc: nikita.shubin, arnd, vkoul, linux, alexandre.belloni, fkan,
linux-pm, liguangshuo
[-- Attachment #1: Type: text/plain, Size: 1703 bytes --]
Hi,
On Sun, Nov 29, 2026 at 05:47:41PM +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: 9fa7cdb4368f ("power: reset: Add a driver for the ep93xx 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/ep93xx-restart.c | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/power/reset/ep93xx-restart.c b/drivers/power/reset/ep93xx-restart.c
> index 46415a3071e7..a65c84e4e5a7 100644
> --- a/drivers/power/reset/ep93xx-restart.c
> +++ b/drivers/power/reset/ep93xx-restart.c
> @@ -41,6 +41,11 @@ static int ep93xx_restart_handle(struct notifier_block *this,
> return NOTIFY_DONE;
> }
>
> +static void ep93xx_reboot_unregister(void *data)
> +{
> + unregister_restart_handler(data);
> +}
> +
> static int ep93xx_reboot_probe(struct auxiliary_device *adev,
> const struct auxiliary_device_id *id)
> {
> @@ -65,7 +70,8 @@ static int ep93xx_reboot_probe(struct auxiliary_device *adev,
> if (err)
> return dev_err_probe(dev, err, "can't register restart notifier\n");
>
> - return 0;
> + return devm_add_action_or_reset(dev, ep93xx_reboot_unregister,
> + &priv->restart_handler);
> }
>
> static const struct auxiliary_device_id ep93xx_reboot_ids[] = {
>
> --
> 2.43.0
>
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 3/4] power: reset: ocelot: Unregister the restart handler on removal
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
0 siblings, 0 replies; 9+ messages in thread
From: Sebastian Reichel @ 2026-12-05 22:57 UTC (permalink / raw)
To: Tian Xuechen
Cc: nikita.shubin, arnd, vkoul, linux, alexandre.belloni, fkan,
linux-pm, liguangshuo
[-- 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 --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 4/4] power: reset: syscon-reboot: Unregister the restart handler on removal
2026-11-29 9:47 ` [PATCH 4/4] power: reset: syscon-reboot: " Tian Xuechen
@ 2026-12-05 22:58 ` Sebastian Reichel
0 siblings, 0 replies; 9+ messages in thread
From: Sebastian Reichel @ 2026-12-05 22:58 UTC (permalink / raw)
To: Tian Xuechen
Cc: nikita.shubin, arnd, vkoul, linux, alexandre.belloni, fkan,
linux-pm, liguangshuo
[-- 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 --]
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2026-12-05 22:59 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox