From: Ulf Hansson Date: Mon, 20 Mar 2017 10:19:22 +0000 (+0100) Subject: PM / Domains: Respect errors from genpd's ->power_off() callback X-Git-Tag: v4.13-rc2~27^2^3~15 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1c14967c6ea0deb3db4a974b1de519f5a5593ef4;p=platform%2Fkernel%2Flinux-exynos.git PM / Domains: Respect errors from genpd's ->power_off() callback The current code in genpd_sync_power_off(), doesn't care about potential errors being returned from genpd's ->power_off() callback. Obviously this behaviour could lead to problems, such as incorrectly setting the genpd's status to GPD_STATE_POWER_OFF, but also to incorrectly decrease the subdomain count for the masters, which potentially allows them to be powered off in the next recursive call to genpd_sync_power_off(). Let's fix this behaviour by bailing out when the ->power_off() callback returns an error code. Signed-off-by: Ulf Hansson Reviewed-by: Viresh Kumar Reviewed-by: Geert Uytterhoeven Reviewed-by: Bartlomiej Zolnierkiewicz Signed-off-by: Rafael J. Wysocki --- diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index c71a7ef..c0318c1 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -767,7 +767,8 @@ static void genpd_sync_power_off(struct generic_pm_domain *genpd, bool use_lock, /* Choose the deepest state when suspending */ genpd->state_idx = genpd->state_count - 1; - _genpd_power_off(genpd, false); + if (_genpd_power_off(genpd, false)) + return; genpd->status = GPD_STATE_POWER_OFF;