diff options
author | Ulf Hansson <ulf.hansson@linaro.org> | 2020-07-07 14:58:02 +0200 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2020-07-29 18:38:30 +0200 |
commit | 166bf83529c47ddcd4854ff2047f4f980dc492c8 (patch) | |
tree | c1091d91601801ef65bd7ceca83397acec194520 /drivers/cpuidle/cpuidle-psci-domain.c | |
parent | cpuidle: psci: Fail cpuidle registration if set OSI mode failed (diff) | |
download | linux-166bf83529c47ddcd4854ff2047f4f980dc492c8.tar.xz linux-166bf83529c47ddcd4854ff2047f4f980dc492c8.zip |
cpuidle: psci: Fix error path via converting to a platform driver
The current error paths for the cpuidle-psci driver, may leak memory or
possibly leave CPU devices attached to their PM domains. These are quite
harmless issues, but still deserves to be taken care of.
Although, rather than fixing them by keeping track of allocations that
needs to be freed, which tends to become a bit messy, let's convert into a
platform driver. In this way, it gets easier to fix the memory leaks as we
can rely on the devm_* functions.
Moreover, converting to a platform driver also enables support for deferred
probe, which subsequent changes takes benefit from.
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/cpuidle/cpuidle-psci-domain.c')
-rw-r--r-- | drivers/cpuidle/cpuidle-psci-domain.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/cpuidle/cpuidle-psci-domain.c b/drivers/cpuidle/cpuidle-psci-domain.c index f07786aad673..e48e578aaa7d 100644 --- a/drivers/cpuidle/cpuidle-psci-domain.c +++ b/drivers/cpuidle/cpuidle-psci-domain.c @@ -287,7 +287,7 @@ out: } subsys_initcall(psci_idle_init_domains); -struct device __init *psci_dt_attach_cpu(int cpu) +struct device *psci_dt_attach_cpu(int cpu) { struct device *dev; @@ -301,3 +301,11 @@ struct device __init *psci_dt_attach_cpu(int cpu) return dev; } + +void psci_dt_detach_cpu(struct device *dev) +{ + if (IS_ERR_OR_NULL(dev)) + return; + + dev_pm_domain_detach(dev, false); +} |