drivers/cpuidle/dt_idle_genpd.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
dt_idle_pd_alloc() kasprintf()s the full node path, then points
pd->name at kbasename() of that string. dt_idle_pd_free() kfree()s
pd->name, which is no longer the start of the allocation.
Copy the basename instead.
Fixes: 9d976d6721df ("cpuidle: Factor-out power domain related code from PSCI domain driver")
Signed-off-by: Linkai Gong <gonglinkai@kylinos.cn>
---
drivers/cpuidle/dt_idle_genpd.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/cpuidle/dt_idle_genpd.c b/drivers/cpuidle/dt_idle_genpd.c
index d292975cc468..ed41a90eeeb7 100644
--- a/drivers/cpuidle/dt_idle_genpd.c
+++ b/drivers/cpuidle/dt_idle_genpd.c
@@ -99,7 +99,7 @@ struct generic_pm_domain *dt_idle_pd_alloc(struct device_node *np,
if (!pd)
goto out;
- pd->name = kasprintf(GFP_KERNEL, "%pOF", np);
+ pd->name = kstrdup(kbasename(of_node_full_name(np)), GFP_KERNEL);
if (!pd->name)
goto free_pd;
@@ -112,7 +112,6 @@ struct generic_pm_domain *dt_idle_pd_alloc(struct device_node *np,
goto free_name;
pd->free_states = pd_free_states;
- pd->name = kbasename(pd->name);
pd->states = states;
pd->state_count = state_count;
--
2.25.1
On Fri, Aug 21, 2026 at 9:57 AM Linkai Gong <gonglinkai@kylinos.cn> wrote:
>
> dt_idle_pd_alloc() kasprintf()s the full node path, then points
> pd->name at kbasename() of that string. dt_idle_pd_free() kfree()s
> pd->name, which is no longer the start of the allocation.
>
> Copy the basename instead.
>
> Fixes: 9d976d6721df ("cpuidle: Factor-out power domain related code from PSCI domain driver")
> Signed-off-by: Linkai Gong <gonglinkai@kylinos.cn>
Applied for fixes and by adding a stable tag, thanks!
Kind regards
Uffe
> ---
> drivers/cpuidle/dt_idle_genpd.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/cpuidle/dt_idle_genpd.c b/drivers/cpuidle/dt_idle_genpd.c
> index d292975cc468..ed41a90eeeb7 100644
> --- a/drivers/cpuidle/dt_idle_genpd.c
> +++ b/drivers/cpuidle/dt_idle_genpd.c
> @@ -99,7 +99,7 @@ struct generic_pm_domain *dt_idle_pd_alloc(struct device_node *np,
> if (!pd)
> goto out;
>
> - pd->name = kasprintf(GFP_KERNEL, "%pOF", np);
> + pd->name = kstrdup(kbasename(of_node_full_name(np)), GFP_KERNEL);
> if (!pd->name)
> goto free_pd;
>
> @@ -112,7 +112,6 @@ struct generic_pm_domain *dt_idle_pd_alloc(struct device_node *np,
> goto free_name;
>
> pd->free_states = pd_free_states;
> - pd->name = kbasename(pd->name);
> pd->states = states;
> pd->state_count = state_count;
>
> --
> 2.25.1
>
© 2016 - 2026 Red Hat, Inc.