From be0fd4cd73fc5156b6e277bdd8233637eed8cc60 Mon Sep 17 00:00:00 2001 From: Shiraz Hashim Date: Fri, 18 Sep 2026 00:37:35 +0530 Subject: [PATCH] WORKAROUND: ras: aest: Fix duplicate CPU PM notifier registration aest_device_probe() runs once per AEST platform device, and a target can expose several of these (e.g. a global processor node plus one node per shared cache-cluster, as on Qualcomm platforms). Since the CPU PM notifier was moved into probe(), every extra device re-registers the same static notifier_block on the global cpu_pm chain, tripping the duplicate-entry WARN in notifier_chain_register(): notifier callback aest_cpu_pm_notify already registered Guard aest_cpu_pm_init()/aest_cpu_pm_exit() with a one-time flag so the actual callback is registered once, regardless of how many AEST devices probe. Fixes: 0132f7bc9b90 ("WORKAROUND: Move CPU PM notifier registration to Probe") Signed-off-by: Shiraz Hashim --- drivers/ras/aest/aest-core.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/ras/aest/aest-core.c b/drivers/ras/aest/aest-core.c index 3e1344c937f23..a9894a961d03a 100644 --- a/drivers/ras/aest/aest-core.c +++ b/drivers/ras/aest/aest-core.c @@ -110,14 +110,31 @@ static struct notifier_block aest_cpu_pm_nb = { .notifier_call = aest_cpu_pm_notify, }; +/* + * platform_driver_register() walks matching devices synchronously in + * the calling thread (this driver does not opt into async probing, and + * aest_device_probe() never returns -EPROBE_DEFER), so repeated probes + * are strictly sequential, not concurrent -- a plain bool is sufficient + * and no additional locking is required here. + */ +static bool aest_cpu_pm_nb_registered; + static void aest_cpu_pm_init(void) { + if (aest_cpu_pm_nb_registered) + return; + cpu_pm_register_notifier(&aest_cpu_pm_nb); + aest_cpu_pm_nb_registered = true; } static void aest_cpu_pm_exit(void) { + if (!aest_cpu_pm_nb_registered) + return; + cpu_pm_unregister_notifier(&aest_cpu_pm_nb); + aest_cpu_pm_nb_registered = false; } #else static inline void aest_cpu_pm_init(void) { }