From: Heiko Stuebner <heiko@sntech.de>
To: linux-rockchip@lists.infradead.org
Cc: linux-kernel@vger.kernel.org, tomeu.vizoso@collabora.com,
wxt@rock-chips.com, rjw@rjwysocki.net,
Heiko Stuebner <heiko@sntech.de>
Subject: [PATCH 1/2] soc: rockchip: power-domain: use pm_genpd_remove in error cleanup
Date: Fri, 16 Sep 2016 00:14:38 +0200 [thread overview]
Message-ID: <1473977679-18649-2-git-send-email-heiko@sntech.de> (raw)
In-Reply-To: <1473977679-18649-1-git-send-email-heiko@sntech.de>
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>
---
drivers/soc/rockchip/pm_domains.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/drivers/soc/rockchip/pm_domains.c b/drivers/soc/rockchip/pm_domains.c
index 7acd151..241df213 100644
--- a/drivers/soc/rockchip/pm_domains.c
+++ b/drivers/soc/rockchip/pm_domains.c
@@ -445,7 +445,16 @@ static int rockchip_pm_add_one_domain(struct rockchip_pmu *pmu,
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]);
--
2.8.1
next prev parent reply other threads:[~2016-09-15 22:15 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-15 22:14 [PATCH 0/2] soc: rockchip: fix probe error path in power-domain driver Heiko Stuebner
2016-09-15 22:14 ` Heiko Stuebner [this message]
2016-09-15 22:14 ` [PATCH 2/2] soc: rockchip: power-domain: Handle errors from of_genpd_add_provider_onecell Heiko Stuebner
2016-11-01 22:50 ` [PATCH 0/2] soc: rockchip: fix probe error path in power-domain driver Heiko Stuebner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1473977679-18649-2-git-send-email-heiko@sntech.de \
--to=heiko@sntech.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=rjw@rjwysocki.net \
--cc=tomeu.vizoso@collabora.com \
--cc=wxt@rock-chips.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox