From: Mika Westerberg <mika.westerberg@linux.intel.com>
To: Guangshuo Li <lgs201920130244@gmail.com>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Lee Jones <lee@kernel.org>,
mfd@lists.linux.dev, linux-kernel@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH] mfd: intel-lpss: fix iDMA device leak on probe failure
Date: Thu, 24 Sep 2026 15:41:13 +0200 [thread overview]
Message-ID: <20260924134113.GQ106095@black.igk.intel.com> (raw)
In-Reply-To: <CANUHTR_Su1KxOeB2fJDwzVeyW4WpnWuzTYm=6Yz4z12Pr6GugQ@mail.gmail.com>
On Thu, Sep 24, 2026 at 08:00:29PM +0800, Guangshuo Li wrote:
> Thanks Andy and Mika.
>
> On Tue, 22 Sept 2026 at 20:33, Mika Westerberg
> <mika.westerberg@linux.intel.com> wrote:
> >
> > On Tue, Sep 22, 2026 at 03:29:24PM +0300, Andy Shevchenko wrote:
> > > On Tue, Sep 22, 2026 at 03:59:32PM +0800, Guangshuo Li wrote:
> > > > On Mon, 21 Sept 2026 at 19:05, Mika Westerberg
> > > > <mika.westerberg@linux.intel.com> wrote:
> > > > > On Mon, Sep 21, 2026 at 06:40:58PM +0800, Guangshuo Li wrote:
> > >
> > > > > I think this could use devm_mfd_add_devices() instead.
> > > > >
> > > > > > The issue was identified by a static analysis tool I developed and
> > > > > > confirmed by manual review.
> > >
> > > > Do you mean converting both MFD registrations to devm_mfd_add_devices()
> > > > and dropping the explicit mfd_remove_devices() from the remove path, like
> > > > this?
> > >
> > > Won't work properly. The rule of thumb, it should be no 'goto' after devm_*() call.
> >
> > hmm, isn't the unwind done in driver core and has nothing to do with goto?
> > Maybe things have changed since I last time looked? ;-)
>
> devm_mfd_add_devices() would remove the children when the parent
> device's devres is released after probe returns an error. However, the
> current error path tears down the debugfs, LTR, clock, and IDA state
> before returning, while intel_lpss_remove() removes the MFD children
> before those resources.
>
> Given that ordering, would keeping mfd_add_devices() and adding
> mfd_remove_devices() at err_remove_ltr, as in the original patch, be
> preferable here?
Yes I agree,
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
prev parent reply other threads:[~2026-09-24 13:41 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-21 10:40 Guangshuo Li
2026-09-21 11:05 ` Mika Westerberg
2026-09-22 7:59 ` Guangshuo Li
2026-09-22 12:29 ` Andy Shevchenko
2026-09-22 12:33 ` Mika Westerberg
2026-09-24 12:00 ` Guangshuo Li
2026-09-24 13:41 ` Mika Westerberg [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=20260924134113.GQ106095@black.igk.intel.com \
--to=mika.westerberg@linux.intel.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=lee@kernel.org \
--cc=lgs201920130244@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mfd@lists.linux.dev \
--cc=stable@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®