diff options
author | Heiko Stuebner <heiko@sntech.de> | 2016-09-16 00:14:38 +0200 |
---|---|---|
committer | Heiko Stuebner <heiko@sntech.de> | 2016-11-11 02:14:59 +0100 |
commit | 79d12b7a7f227ed51dd86b16a7536b391e46f7b0 (patch) | |
tree | 4c173503c607da895d58b4aac2edd7bd830770a1 | |
parent | soc: rockchip: power-domain: avoid infinite loop (diff) | |
download | linux-79d12b7a7f227ed51dd86b16a7536b391e46f7b0.tar.xz linux-79d12b7a7f227ed51dd86b16a7536b391e46f7b0.zip |
soc: rockchip: power-domain: use pm_genpd_remove in error cleanup
The newly introduced pm_genpd_remove reverts the initialization done
by pm_genpd_init and is necessary in the error path of the rockchip
power-domain driver.
Without it the driver will in the error case cleanup the devm-allocated
structures including the elements referenced in the gpd_list thus making
deactivation of unused domains (and probably later genpd accesses as
well) fail by accessing invalid pointers.
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
-rw-r--r-- | drivers/soc/rockchip/pm_domains.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/soc/rockchip/pm_domains.c b/drivers/soc/rockchip/pm_domains.c index 988bfd708706..d36a7351af9d 100644 --- a/drivers/soc/rockchip/pm_domains.c +++ b/drivers/soc/rockchip/pm_domains.c @@ -479,7 +479,16 @@ err_out: static void rockchip_pm_remove_one_domain(struct rockchip_pm_domain *pd) { - int i; + int i, ret; + + /* + * We're in the error cleanup already, so we only complain, + * but won't emit another error on top of the original one. + */ + ret = pm_genpd_remove(&pd->genpd); + if (ret < 0) + dev_err(pd->pmu->dev, "failed to remove domain '%s' : %d - state may be inconsistent\n", + pd->genpd.name, ret); for (i = 0; i < pd->num_clks; i++) { clk_unprepare(pd->clks[i]); |