From: Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org>
To: Bryan O'Donoghue <bryan.odonoghue@linaro.org>,
Bjorn Andersson <andersson@kernel.org>,
Michael Turquette <mturquette@baylibre.com>,
Stephen Boyd <sboyd@kernel.org>,
Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Cc: linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org,
linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH v8 1/3] clk: qcom: gdsc: Capture pm_genpd_add_subdomain result code
Date: Thu, 12 Dec 2024 17:10:24 +0200 [thread overview]
Message-ID: <09dd1971-74f5-45df-9ecc-e5c2253f416f@linaro.org> (raw)
In-Reply-To: <20241211-b4-linux-next-24-11-18-clock-multiple-power-domains-v8-1-5d93cef910a4@linaro.org>
On 12/11/24 18:54, Bryan O'Donoghue wrote:
> Adding a new clause to this if/else I noticed the existing usage of
> pm_genpd_add_subdomain() wasn't capturing and returning the result code.
>
> pm_genpd_add_subdomain() returns an int and can fail. Capture that result
> code and throw it up the call stack if something goes wrong.
>
> Fixes: 1b771839de05 ("clk: qcom: gdsc: enable optional power domain support")
> Cc: stable@vger.kernel.org
> Reviewed-by: Bjorn Andersson <andersson@kernel.org>
> Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
> ---
> drivers/clk/qcom/gdsc.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/clk/qcom/gdsc.c b/drivers/clk/qcom/gdsc.c
> index fa5fe4c2a2ee7786c2e8858f3e41301f639e5d59..4fc6f957d0b846cc90e50ef243f23a7a27e66899 100644
> --- a/drivers/clk/qcom/gdsc.c
> +++ b/drivers/clk/qcom/gdsc.c
> @@ -555,9 +555,11 @@ int gdsc_register(struct gdsc_desc *desc,
> if (!scs[i])
> continue;
> if (scs[i]->parent)
> - pm_genpd_add_subdomain(scs[i]->parent, &scs[i]->pd);
> + ret = pm_genpd_add_subdomain(scs[i]->parent, &scs[i]->pd);
> else if (!IS_ERR_OR_NULL(dev->pm_domain))
> - pm_genpd_add_subdomain(pd_to_genpd(dev->pm_domain), &scs[i]->pd);
> + ret = pm_genpd_add_subdomain(pd_to_genpd(dev->pm_domain), &scs[i]->pd);
> + if (ret)
> + return ret;
This is wrong, on the error path you shall rollback the registered subdomains
in the reverse order.
> }
>
> return of_genpd_add_provider_onecell(dev->of_node, data);
>
--
Best wishes,
Vladimir
next prev parent reply other threads:[~2024-12-12 15:10 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-11 16:54 [PATCH v8 0/3] clk: qcom: Add support for multiple power-domains for a clock controller Bryan O'Donoghue
2024-12-11 16:54 ` [PATCH v8 1/3] clk: qcom: gdsc: Capture pm_genpd_add_subdomain result code Bryan O'Donoghue
2024-12-12 15:10 ` Vladimir Zapolskiy [this message]
2024-12-11 16:54 ` [PATCH v8 2/3] clk: qcom: common: Add support for power-domain attachment Bryan O'Donoghue
2024-12-12 15:07 ` Vladimir Zapolskiy
2024-12-11 16:54 ` [PATCH v8 3/3] clk: qcom: Support attaching GDSCs to multiple parents Bryan O'Donoghue
2024-12-12 15:06 ` Vladimir Zapolskiy
2024-12-12 15:18 ` Bryan O'Donoghue
2024-12-12 18:49 ` Vladimir Zapolskiy
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=09dd1971-74f5-45df-9ecc-e5c2253f416f@linaro.org \
--to=vladimir.zapolskiy@linaro.org \
--cc=andersson@kernel.org \
--cc=bryan.odonoghue@linaro.org \
--cc=dmitry.baryshkov@linaro.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mturquette@baylibre.com \
--cc=sboyd@kernel.org \
--cc=stable@vger.kernel.org \
/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