FAILED: patch "[PATCH] hwrng: stm32 - Fix runtime PM cleanup on registration failure" failed to apply to 6.12-stable tree
Subsystems (3)
[email protected]
maintainerThe patch below does not apply to the 6.12-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.12.y
git checkout FETCH_HEAD
git cherry-pick -x 1163a476a568f6c0f852d469c8e4c5a5f805adac
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026090318-jester-velocity-118b@gregkh' --subject-prefix 'PATCH 6.12.y' 'HEAD^..'
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 1163a476a568f6c0f852d469c8e4c5a5f805adac Mon Sep 17 00:00:00 2001
From: Can Peng <[email protected]>
Date: Sat, 18 Jul 2026 11:29:37 +0800
Subject: [PATCH] hwrng: stm32 - Fix runtime PM cleanup on registration failure
stm32_rng_probe() enables autosuspend and runtime PM before registering the hwrng. If devm_hwrng_register() fails, probe returns with runtime PM left enabled and autosuspend still selected.
The remove callback also only disables runtime PM and does not undo pm_runtime_use_autosuspend().
Use devm_pm_runtime_enable() so runtime PM is unwound automatically on probe failure and driver detach. Since the managed cleanup also disables runtime PM,drop the remove callback.
drivers/char/hw_random/stm32-rng.c +3 -7
@@ -368,11 +368,6 @@ static int stm32_rng_init(struct hwrng *rng)return 0 ; } -static void stm32_rng_remove (struct platform_device *ofdev) -{ -pm_runtime_disable (&ofdev->dev); -} -static int __maybe_unused stm32_rng_runtime_suspend (struct device *dev) {struct stm32_rng_private *priv =dev_get_drvdata (dev);
@@ -590,7 +585,9 @@ static int stm32_rng_probe(struct platform_device *ofdev)pm_runtime_set_autosuspend_delay (dev,100 );pm_runtime_use_autosuspend (dev); -pm_runtime_enable (dev); + ret =devm_pm_runtime_enable (dev); +if (ret) +return ret;return devm_hwrng_register (dev, &priv->rng); }
@@ -602,7 +599,6 @@ static struct platform_driver stm32_rng_driver = { .of_match_table = stm32_rng_match, }, .probe = stm32_rng_probe, - .remove = stm32_rng_remove, };module_platform_driver (stm32_rng_driver);
Sasha Levin
maintainerPATCH 1/2 hwrng: drivers - Switch back to struct platform_driver::remove()
From: Uwe Kleine-König <[email protected]>
[ Upstream commit d11c8b87a36267a2861b9010ce0393de8ff3d278 ]
After commit 0edb555a65d1 ("platform: Make platform_driver::remove() return void") .remove() is (again) the right callback to implement for platform drivers.
Convert all platform drivers below drivers/char/hw_random to use .remove(), with the eventual goal to drop struct platform_driver::remove_new(). As .remove() and .remove_new() have the same prototypes, conversion is done by just changing the structure member name in the driver initializer.
Stable-dep-of: 1163a476a568 ("hwrng: stm32 - Fix runtime PM cleanup on registration failure")
--- drivers/char/hw_random/atmel-rng.c | 2 +- drivers/char/hw_random/cctrng.c | 2 +- drivers/char/hw_random/exynos-trng.c | 2 +- drivers/char/hw_random/ingenic-rng.c | 2 +- drivers/char/hw_random/ks-sa-rng.c | 2 +- drivers/char/hw_random/mxc-rnga.c | 2 +- drivers/char/hw_random/n2-drv.c | 2 +- drivers/char/hw_random/npcm-rng.c | 2 +- drivers/char/hw_random/omap-rng.c | 2 +- drivers/char/hw_random/stm32-rng.c | 2 +- drivers/char/hw_random/timeriomem-rng.c | 2 +- drivers/char/hw_random/xgene-rng.c | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-)
drivers/char/hw_random/atmel-rng.c +1 -1
@@ -216,7 +216,7 @@ MODULE_DEVICE_TABLE(of, atmel_trng_dt_ids);static struct platform_driver atmel_trng_driver = { .probe = atmel_trng_probe, - .remove_new = atmel_trng_remove, + .remove = atmel_trng_remove, .driver = { .name ="atmel-trng" , .pm =pm_ptr (&atmel_trng_pm_ops),
drivers/char/hw_random/cctrng.c +1 -1
@@ -653,7 +653,7 @@ static struct platform_driver cctrng_driver = { .pm = &cctrng_pm, }, .probe = cctrng_probe, - .remove_new = cctrng_remove, + .remove = cctrng_remove, };module_platform_driver (cctrng_driver);
drivers/char/hw_random/exynos-trng.c +1 -1
@@ -335,7 +335,7 @@ static struct platform_driver exynos_trng_driver = { .of_match_table = exynos_trng_dt_match, }, .probe = exynos_trng_probe, - .remove_new = exynos_trng_remove, + .remove = exynos_trng_remove, };module_platform_driver (exynos_trng_driver);
drivers/char/hw_random/ingenic-rng.c +1 -1
@@ -132,7 +132,7 @@ MODULE_DEVICE_TABLE(of, ingenic_rng_of_match);static struct platform_driver ingenic_rng_driver = { .probe = ingenic_rng_probe, - .remove_new = ingenic_rng_remove, + .remove = ingenic_rng_remove, .driver = { .name ="ingenic-rng" , .of_match_table = ingenic_rng_of_match,
drivers/char/hw_random/ks-sa-rng.c +1 -1
@@ -265,7 +265,7 @@ static struct platform_driver ks_sa_rng_driver = { .of_match_table = ks_sa_rng_dt_match, }, .probe = ks_sa_rng_probe, - .remove_new = ks_sa_rng_remove, + .remove = ks_sa_rng_remove, };module_platform_driver (ks_sa_rng_driver);
drivers/char/hw_random/mxc-rnga.c +1 -1
@@ -188,7 +188,7 @@ static struct platform_driver mxc_rnga_driver = { .of_match_table = mxc_rnga_of_match, }, .probe = mxc_rnga_probe, - .remove_new = mxc_rnga_remove, + .remove = mxc_rnga_remove, };module_platform_driver (mxc_rnga_driver);
drivers/char/hw_random/n2-drv.c +1 -1
@@ -858,7 +858,7 @@ static struct platform_driver n2rng_driver = { .of_match_table = n2rng_match, }, .probe = n2rng_probe, - .remove_new = n2rng_remove, + .remove = n2rng_remove, };module_platform_driver (n2rng_driver);
drivers/char/hw_random/npcm-rng.c +1 -1
@@ -176,7 +176,7 @@ static struct platform_driver npcm_rng_driver = { .of_match_table = of_match_ptr(rng_dt_id), }, .probe = npcm_rng_probe, - .remove_new = npcm_rng_remove, + .remove = npcm_rng_remove, };module_platform_driver (npcm_rng_driver);
drivers/char/hw_random/omap-rng.c +1 -1
@@ -558,7 +558,7 @@ static struct platform_driver omap_rng_driver = { .of_match_table = of_match_ptr(omap_rng_of_match), }, .probe = omap_rng_probe, - .remove_new = omap_rng_remove, + .remove = omap_rng_remove, };module_platform_driver (omap_rng_driver);
drivers/char/hw_random/stm32-rng.c +1 -1
@@ -565,7 +565,7 @@ static struct platform_driver stm32_rng_driver = { .of_match_table = stm32_rng_match, }, .probe = stm32_rng_probe, - .remove_new = stm32_rng_remove, + .remove = stm32_rng_remove, };module_platform_driver (stm32_rng_driver);
drivers/char/hw_random/timeriomem-rng.c +1 -1
@@ -193,7 +193,7 @@ static struct platform_driver timeriomem_rng_driver = { .of_match_table = timeriomem_rng_match, }, .probe = timeriomem_rng_probe, - .remove_new = timeriomem_rng_remove, + .remove = timeriomem_rng_remove, };module_platform_driver (timeriomem_rng_driver);
drivers/char/hw_random/xgene-rng.c +1 -1
@@ -375,7 +375,7 @@ MODULE_DEVICE_TABLE(of, xgene_rng_of_match);static struct platform_driver xgene_rng_driver = { .probe = xgene_rng_probe, - .remove_new = xgene_rng_remove, + .remove = xgene_rng_remove, .driver = { .name ="xgene-rng" , .of_match_table = xgene_rng_of_match,
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 2/2 hwrng: stm32 - Fix runtime PM cleanup on registration failure
From: Can Peng <[email protected]>
[ Upstream commit 1163a476a568f6c0f852d469c8e4c5a5f805adac ]
stm32_rng_probe() enables autosuspend and runtime PM before registering the hwrng. If devm_hwrng_register() fails, probe returns with runtime PM left enabled and autosuspend still selected.
The remove callback also only disables runtime PM and does not undo pm_runtime_use_autosuspend().
Use devm_pm_runtime_enable() so runtime PM is unwound automatically on probe failure and driver detach. Since the managed cleanup also disables runtime PM,drop the remove callback.
--- drivers/char/hw_random/stm32-rng.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)
drivers/char/hw_random/stm32-rng.c +4 -7
@@ -366,11 +366,6 @@ static int stm32_rng_init(struct hwrng *rng)return 0 ; } -static void stm32_rng_remove (struct platform_device *ofdev) -{ -pm_runtime_disable (&ofdev->dev); -} -static int __maybe_unused stm32_rng_runtime_suspend (struct device *dev) {struct stm32_rng_private *priv =dev_get_drvdata (dev);
@@ -516,6 +511,7 @@ static int stm32_rng_probe(struct platform_device *ofdev)struct device_node *np = ofdev->dev.of_node;struct stm32_rng_private *priv;struct resource *res; +int ret; priv =devm_kzalloc (dev,sizeof (*priv),GFP_KERNEL );if (!priv)
@@ -553,7 +549,9 @@ static int stm32_rng_probe(struct platform_device *ofdev)pm_runtime_set_autosuspend_delay (dev,100 );pm_runtime_use_autosuspend (dev); -pm_runtime_enable (dev); + ret =devm_pm_runtime_enable (dev); +if (ret) +return ret;return devm_hwrng_register (dev, &priv->rng); }
@@ -565,7 +563,6 @@ static struct platform_driver stm32_rng_driver = { .of_match_table = stm32_rng_match, }, .probe = stm32_rng_probe, - .remove = stm32_rng_remove, };module_platform_driver (stm32_rng_driver);
Signature · 1 line
2.53.0