From: Krzysztof Kozlowski <krzk@kernel.org>
To: Arvind Yadav <arvind.yadav.cs@gmail.com>
Cc: lee.jones@linaro.org, kgene@kernel.org,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-samsung-soc@vger.kernel.org
Subject: Re: [PATCH] mfd: exynos-lpass: Handle return value of clk_prepare_enable
Date: Tue, 8 Aug 2017 20:25:59 +0200 [thread overview]
Message-ID: <20170808182559.b5muiyk5vmurtznc@kozik-lap> (raw)
In-Reply-To: <0e52a230fce95714a12b72aeb1ee9be0490de2a6.1502192959.git.arvind.yadav.cs@gmail.com>
On Tue, Aug 08, 2017 at 05:20:55PM +0530, Arvind Yadav wrote:
> clk_prepare_enable() can fail here and we must check its return value.
> we must call pm_runtime_disable() and pm_runtime_set_suspended(),
> If exynos_lpass_probe is not successful.
>
> Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
This is not a trivial change so please mark all such patches as RFT.
Submit checklist mentions testing in multiple steps and last time your
ASoC changes were not tested.
> ---
> drivers/mfd/exynos-lpass.c | 23 ++++++++++++++++-------
> 1 file changed, 16 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/mfd/exynos-lpass.c b/drivers/mfd/exynos-lpass.c
> index ca829f8..c74ff62 100644
> --- a/drivers/mfd/exynos-lpass.c
> +++ b/drivers/mfd/exynos-lpass.c
> @@ -73,9 +73,13 @@ static void exynos_lpass_core_sw_reset(struct exynos_lpass *lpass, int mask)
> regmap_write(lpass->top, SFR_LPASS_CORE_SW_RESET, val);
> }
>
> -static void exynos_lpass_enable(struct exynos_lpass *lpass)
> +static int exynos_lpass_enable(struct exynos_lpass *lpass)
> {
> - clk_prepare_enable(lpass->sfr0_clk);
> + int ret;
> +
> + ret = clk_prepare_enable(lpass->sfr0_clk);
> + if (ret)
> + return ret;
>
> /* Unmask SFR, DMA and I2S interrupt */
> regmap_write(lpass->top, SFR_LPASS_INTR_CA5_MASK,
> @@ -87,6 +91,8 @@ static void exynos_lpass_enable(struct exynos_lpass *lpass)
> exynos_lpass_core_sw_reset(lpass, LPASS_I2S_SW_RESET);
> exynos_lpass_core_sw_reset(lpass, LPASS_DMA_SW_RESET);
> exynos_lpass_core_sw_reset(lpass, LPASS_MEM_SW_RESET);
> +
> + return 0;
> }
>
> static void exynos_lpass_disable(struct exynos_lpass *lpass)
> @@ -112,6 +118,7 @@ static int exynos_lpass_probe(struct platform_device *pdev)
> struct exynos_lpass *lpass;
> void __iomem *base_top;
> struct resource *res;
> + int ret;
>
> lpass = devm_kzalloc(dev, sizeof(*lpass), GFP_KERNEL);
> if (!lpass)
> @@ -136,8 +143,12 @@ static int exynos_lpass_probe(struct platform_device *pdev)
> platform_set_drvdata(pdev, lpass);
> pm_runtime_set_active(dev);
> pm_runtime_enable(dev);
> - exynos_lpass_enable(lpass);
> -
> + ret = exynos_lpass_enable(lpass);
> + if (ret) {
> + pm_runtime_disable(dev);
> + pm_runtime_set_suspended(dev);
You need also regmap_exit().
> + return ret;
> + }
Leave one blank line before return.
Best regards,
Krzysztof
next prev parent reply other threads:[~2017-08-08 18:26 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-08 11:50 Arvind Yadav
2017-08-08 18:25 ` Krzysztof Kozlowski [this message]
2017-08-09 4:40 ` Arvind Yadav
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=20170808182559.b5muiyk5vmurtznc@kozik-lap \
--to=krzk@kernel.org \
--cc=arvind.yadav.cs@gmail.com \
--cc=kgene@kernel.org \
--cc=lee.jones@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-samsung-soc@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
all inboxes | Powered by JetHome®