From: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
To: "jia-wei.chang" <jia-wei.chang@mediatek.com>,
MyungJoo Ham <myungjoo.ham@samsung.com>,
Kyungmin Park <kyungmin.park@samsung.com>,
Chanwoo Choi <cw00.choi@samsung.com>,
Matthias Brugger <matthias.bgg@gmail.com>,
Johnson Wang <johnson.wang@mediatek.com>
Cc: linux-arm-kernel@lists.infradead.org,
linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org,
Project_Global_Chrome_Upstream_Group@mediatek.com,
hsinyi@google.com
Subject: Re: [PATCH] PM / devfreq: mtk-cci: refactor error handling of probe and remove
Date: Wed, 3 May 2023 13:40:56 +0200 [thread overview]
Message-ID: <6439bf4e-979e-889e-c97d-e7b1dd94b4f1@collabora.com> (raw)
In-Reply-To: <20230503092742.19404-1-jia-wei.chang@mediatek.com>
Il 03/05/23 11:27, jia-wei.chang ha scritto:
> From: Jia-Wei Chang <jia-wei.chang@mediatek.com>
>
> To refactor the regulator/clk handlers so it can follow the way of "Free
> the Last Thing Style".
>
> Signed-off-by: Jia-Wei Chang <jia-wei.chang@mediatek.com>
> Fixes: 86d231b1db1b ("PM / devfreq: mediatek: Introduce MediaTek CCI devfreq driver")
> ---
> drivers/devfreq/mtk-cci-devfreq.c | 47 ++++++++++++++++++-------------
> 1 file changed, 28 insertions(+), 19 deletions(-)
>
> diff --git a/drivers/devfreq/mtk-cci-devfreq.c b/drivers/devfreq/mtk-cci-devfreq.c
> index e5458ada5197..d2f743774147 100644
> --- a/drivers/devfreq/mtk-cci-devfreq.c
> +++ b/drivers/devfreq/mtk-cci-devfreq.c
> @@ -294,14 +294,14 @@ static int mtk_ccifreq_probe(struct platform_device *pdev)
> if (IS_ERR(drv->sram_reg)) {
> ret = PTR_ERR(drv->sram_reg);
> if (ret == -EPROBE_DEFER)
> - goto out_free_resources;
> + goto out_disable_proc_reg;
>
> drv->sram_reg = NULL;
> } else {
> ret = regulator_enable(drv->sram_reg);
> if (ret) {
> dev_err(dev, "failed to enable sram regulator\n");
> - goto out_free_resources;
> + goto out_disable_proc_reg;
> }
> }
>
> @@ -316,12 +316,16 @@ static int mtk_ccifreq_probe(struct platform_device *pdev)
>
> ret = clk_prepare_enable(drv->cci_clk);
> if (ret)
> - goto out_free_resources;
> + goto out_disable_sram_reg;
> +
> + ret = clk_prepare_enable(drv->inter_clk);
Adding a clk_prepare_enable() call for a clock must be done in a separate commit.
Besides, there shouldn't be any need to do that, as when you call clk_set_parent()
(done in mtk_ccifreq_target()) on a clock that has flag CLK_OPS_PARENT_ENABLE, the
clk core will automatically call clk_core_prepare_enable() on the new parent.
If you're facing a bug for which the parent is not getting enabled, the solution
is to add CLK_OPS_PARENT_ENABLE to the interested clock.
Regards,
Angelo
next parent reply other threads:[~2023-05-03 11:41 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20230503092742.19404-1-jia-wei.chang@mediatek.com>
2023-05-03 11:40 ` AngeloGioacchino Del Regno [this message]
2023-05-04 3:00 ` Jia-wei Chang (張佳偉)
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=6439bf4e-979e-889e-c97d-e7b1dd94b4f1@collabora.com \
--to=angelogioacchino.delregno@collabora.com \
--cc=Project_Global_Chrome_Upstream_Group@mediatek.com \
--cc=cw00.choi@samsung.com \
--cc=hsinyi@google.com \
--cc=jia-wei.chang@mediatek.com \
--cc=johnson.wang@mediatek.com \
--cc=kyungmin.park@samsung.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=matthias.bgg@gmail.com \
--cc=myungjoo.ham@samsung.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
all inboxes | Powered by JetHome®