From: Jonathan Cameron <jic23@kernel.org>
To: David Lechner <dlechner@baylibre.com>
Cc: "Salah Triki" <salah.triki@gmail.com>,
"Nuno Sá" <nuno.sa@analog.com>,
"Andy Shevchenko" <andy@kernel.org>,
linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4] iio: core: Clean up device correctly on viio_trigger_alloc() failure
Date: Sun, 22 Feb 2026 16:20:42 +0000 [thread overview]
Message-ID: <20260222162043.1791ab3c@jic23-huawei> (raw)
In-Reply-To: <e49877b5-2a8d-43d5-9f8b-de37cde9cdcc@baylibre.com>
On Sat, 21 Feb 2026 11:07:10 -0600
David Lechner <dlechner@baylibre.com> wrote:
> On 2/21/26 1:32 AM, Salah Triki wrote:
> > Once we called device_initialize() we have to call put_device()
> > on it. Refactor the code to make it in the right order.
>
> This could be a bit more clear. Something like ...
>
> Move device_initialize() after all error paths in viio_trigger_alloc().
> Previously, we should have been calling put_device() on any error path
> after device_initialize(), but failed to do so.
>
> Rather than adding put_device(), we can just move device_initialize()
> to avoid needing to unwind it on error.
>
> Additional trig->dev initialization is also moved with this just to
> keep the code organized.
>
>
I used this but edited to be in imperative:
Move device_initialize() after all error paths in viio_trigger_alloc().
Previously, put_device() should have been called on all error paths after
device_initialize(), but that was not done.
Rather than adding put_device(), move device_initialize() to avoid
needing to unwind it on error.
In addition move trig->dev initialization to just before device_initialize()
to related code together
> >
>
> Did we decide this doesn't need a Fixes: tag?
We never identified an actual problem. It's wrong from a best
practice point of view, but I'm not convinced there is a bug
today without the change. Hence not something we'll rush to backport
and no fixes tag.
>
> > Signed-off-by: Salah Triki <salah.triki@gmail.com>
> > ---
> No need to send a new revision for this right away. If Jonathan is
> in the mood, he might fix it up for you.
Done ;)
Applied to the testing branch of iio.git
Thanks for the persistence Salah
(and thanks David for the suggestions!)
>
> With the commit message improved:
>
> Reviewed-by: David Lechner <dlechner@baylibre.com>
>
next prev parent reply other threads:[~2026-02-22 16:20 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-21 7:32 Salah Triki
2026-02-21 17:07 ` David Lechner
2026-02-22 16:20 ` Jonathan Cameron [this message]
2026-02-24 4:48 ` Salah Triki
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=20260222162043.1791ab3c@jic23-huawei \
--to=jic23@kernel.org \
--cc=andy@kernel.org \
--cc=dlechner@baylibre.com \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nuno.sa@analog.com \
--cc=salah.triki@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
all inboxes | Powered by JetHome®