From: Baolin Wang <baolin.wang@linux.alibaba.com>
To: Gaosheng Cui <cuigaosheng1@huawei.com>,
andersson@kernel.org, mcoquelin.stm32@gmail.com,
alexandre.torgue@foss.st.com
Cc: linux-remoteproc@vger.kernel.org,
linux-stm32@st-md-mailman.stormreply.com,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH -next] hwspinlock: stm32: Add missing clk_disable_unprepare in stm32_hwspinlock_probe
Date: Thu, 8 Aug 2024 09:37:00 +0800 [thread overview]
Message-ID: <3b38eee4-1dc3-45b3-85d7-d4923f5e571e@linux.alibaba.com> (raw)
In-Reply-To: <20240803061443.287117-1-cuigaosheng1@huawei.com>
On 2024/8/3 14:14, Gaosheng Cui wrote:
> Add the missing clk_disable_unprepare() before return in
> stm32_hwspinlock_probe().
>
> Signed-off-by: Gaosheng Cui <cuigaosheng1@huawei.com>
> ---
> drivers/hwspinlock/stm32_hwspinlock.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/hwspinlock/stm32_hwspinlock.c b/drivers/hwspinlock/stm32_hwspinlock.c
> index bb5c7e5f7a80..a4e3b9a9e29d 100644
> --- a/drivers/hwspinlock/stm32_hwspinlock.c
> +++ b/drivers/hwspinlock/stm32_hwspinlock.c
> @@ -103,6 +103,7 @@ static int stm32_hwspinlock_probe(struct platform_device *pdev)
> ret = devm_add_action_or_reset(dev, stm32_hwspinlock_disable_clk, pdev);
> if (ret) {
> dev_err(dev, "Failed to register action\n");
> + clk_disable_unprepare(hw->clk);
> return ret;
> }
>
> @@ -112,8 +113,10 @@ static int stm32_hwspinlock_probe(struct platform_device *pdev)
> ret = devm_hwspin_lock_register(dev, &hw->bank, &stm32_hwspinlock_ops,
> 0, STM32_MUTEX_NUM_LOCKS);
>
> - if (ret)
> + if (ret) {
> dev_err(dev, "Failed to register hwspinlock\n");
> + clk_disable_unprepare(hw->clk);
> + }
I don't think this is needed, because if the device initialization
fails, stm32_hwspinlock_disable_clk() will be called to disable the
clock automatically when the device releases its resources. Please check
how devm_add_action_or_reset() work.
prev parent reply other threads:[~2024-08-08 1:37 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-03 6:14 [PATCH -next] hwspinlock: stm32: Add missing clk_disable_unprepare in stm32_hwspinlock_probe Gaosheng Cui
2024-08-08 1:37 ` Baolin Wang [this message]
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=3b38eee4-1dc3-45b3-85d7-d4923f5e571e@linux.alibaba.com \
--to=baolin.wang@linux.alibaba.com \
--cc=alexandre.torgue@foss.st.com \
--cc=andersson@kernel.org \
--cc=cuigaosheng1@huawei.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-remoteproc@vger.kernel.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=mcoquelin.stm32@gmail.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).