[PATCH] PM: domains: not update genpd status when power on fail

From: peng . fan
Date: Tue Jul 06 2021 - 05:31:37 EST


From: Peng Fan <peng.fan@xxxxxxx>

When _genpd_power_on fail, the generic power domain status
should not be changed to GENPD_STATE_ON.

Signed-off-by: Peng Fan <peng.fan@xxxxxxx>
---
drivers/base/power/domain.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
index ab0b740cc0f1..754a5d384479 100644
--- a/drivers/base/power/domain.c
+++ b/drivers/base/power/domain.c
@@ -1101,6 +1101,7 @@ static void genpd_sync_power_on(struct generic_pm_domain *genpd, bool use_lock,
unsigned int depth)
{
struct gpd_link *link;
+ int ret;

if (genpd_status_on(genpd))
return;
@@ -1117,8 +1118,9 @@ static void genpd_sync_power_on(struct generic_pm_domain *genpd, bool use_lock,
genpd_unlock(link->parent);
}

- _genpd_power_on(genpd, false);
- genpd->status = GENPD_STATE_ON;
+ ret = _genpd_power_on(genpd, false);
+ if (!ret)
+ genpd->status = GENPD_STATE_ON;
}

/**
--
2.30.0