From: Jerome Brunet <jbrunet@baylibre.com>
To: sashiko-reviews@lists.linux.dev, "Onur Özkan" <work@onurozkan.dev>
Cc: linux-clk@vger.kernel.org
Subject: Re: [PATCH] clk: devres: make clock cleanup explicit on failure
Date: Fri, 04 Sep 2026 10:12:25 +0200 [thread overview]
Message-ID: <1jld9hl9jq.fsf@starbuckisacylon.baylibre.com> (raw)
In-Reply-To: <20260904080129.A84381F00A3E@smtp.kernel.org>
On ven. 04 sept. 2026 at 08:01, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [Low] Replaces devm_add_action_or_reset() with open-coded error handling to pacify a static analyzer.
> --
>
> commit f91fcabb46a07cc1fa1a03a8bac1f236304fd974
> Author: Onur Özkan <work@onurozkan.dev>
> Subject: clk: devres: make clock cleanup explicit on failure
>
> This commit replaces the standard devm_add_action_or_reset() helper with
> devm_add_action() and an explicitly open-coded clock disable and unprepare
> sequence on failure. This change was made to address a smatch warning.
>
> Link: https://lore.kernel.org/all/apmUPdYtdIM0dQbF@redhat.com
> Closes: https://lore.kernel.org/r/202608090025.dwxdfqFr-lkp@intel.com
Note that when you are fixing something, it usually needs a Fixes tag too.
>
>> diff --git a/drivers/clk/clk-devres.c b/drivers/clk/clk-devres.c
>> index 4cc3863bd7da9..9ed9a7b7b23f4 100644
>> --- a/drivers/clk/clk-devres.c
>> +++ b/drivers/clk/clk-devres.c
>> @@ -123,9 +123,11 @@ struct clk *devm_clk_get_optional_enabled_with_rate(struct device *dev,
>> if (ret)
>> goto out_put_clk;
>>
>> - ret = devm_add_action_or_reset(dev, devm_clk_disable_unprepare, clk);
>> - if (ret)
>> + ret = devm_add_action(dev, devm_clk_disable_unprepare, clk);
>> + if (ret) {
>> + clk_disable_unprepare(clk);
>> goto out_put_clk;
>> + }
>
> [Severity: Low]
> Is it necessary to open-code this cleanup logic in
> devm_clk_get_optional_enabled_with_rate() just to satisfy a static analyzer?
>
> Replacing standard kernel abstractions like devm_add_action_or_reset() with
> manual error handling to pacify a false positive degrades code structure and
> reverts the benefits of the devres pattern.
>
> Should the analyzer be fixed instead of open-coding the manual cleanup
> sequence here?
I tend to agree. If we are missing something, please ellaborate.
>
> --
> Sashiko AI review · https://sashiko.dev/#/patchset/20260904075026.60793-1-work@onurozkan.dev?part=1
--
Jerome
prev parent reply other threads:[~2026-09-04 8:12 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-04 7:50 [PATCH] clk: devres: make clock cleanup explicit on failure Onur Özkan
2026-09-04 8:01 ` sashiko-bot
2026-09-04 8:12 ` Jerome Brunet [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=1jld9hl9jq.fsf@starbuckisacylon.baylibre.com \
--to=jbrunet@baylibre.com \
--cc=linux-clk@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=work@onurozkan.dev \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.