[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <3c809cae-991b-4b13-8d8b-bd6cbcc9a9b9@denx.de>
Date: Thu, 5 Dec 2024 06:07:51 +0100
From: Marek Vasut <marex@...x.de>
To: Mingwei Zheng <zmw12306@...il.com>, linus.walleij@...aro.org,
mcoquelin.stm32@...il.com, alexandre.torgue@...s.st.com, make24@...as.ac.cn,
peng.fan@....com, fabien.dessenne@...s.st.com
Cc: linux-gpio@...r.kernel.org, linux-stm32@...md-mailman.stormreply.com,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
Jiasheng Jiang <jiashengjiangcool@...il.com>
Subject: Re: [PATCH] pinctrl: stm32: Add check for clk_enable()
On 12/5/24 5:59 AM, Mingwei Zheng wrote:
> Add check for the return value of clk_enable() to catch the potential
> error. Add a cleanup loop to disable clocks already enabled in case
> of an error during clock enabling for subsequent banks.
>
> Fixes: 05d8af449d93 ("pinctrl: stm32: Keep pinctrl block clock enabled when LEVEL IRQ requested")
> Signed-off-by: Mingwei Zheng <zmw12306@...il.com>
> Signed-off-by: Jiasheng Jiang <jiashengjiangcool@...il.com>
> ---
> drivers/pinctrl/stm32/pinctrl-stm32.c | 12 +++++++++---
> 1 file changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/pinctrl/stm32/pinctrl-stm32.c b/drivers/pinctrl/stm32/pinctrl-stm32.c
> index 5b7fa77c1184..eb7b2f864d88 100644
> --- a/drivers/pinctrl/stm32/pinctrl-stm32.c
> +++ b/drivers/pinctrl/stm32/pinctrl-stm32.c
> @@ -1738,10 +1738,16 @@ int __maybe_unused stm32_pinctrl_resume(struct device *dev)
> {
> struct stm32_pinctrl *pctl = dev_get_drvdata(dev);
> struct stm32_pinctrl_group *g = pctl->groups;
> - int i;
> + int i, j, ret;
>
> - for (i = 0; i < pctl->nbanks; i++)
> - clk_enable(pctl->banks[i].clk);
> + for (i = 0; i < pctl->nbanks; i++) {
> + ret = clk_enable(pctl->banks[i].clk);
> + if (ret) {
> + for (j = 0; j < i; j++)
Instead of this open-coded loop, can you please convert the driver to
clk_bulk*() API and then do simple clk_bulk_enable()/clk_bulk_disable()
here and everywhere ?
Thank you
Powered by blists - more mailing lists