Re: [PATCH] mfd: intel-lpss: fix iDMA device leak on probe failure

From: Mika Westerberg

Date: Tue Sep 22 2026 - 08:38:01 EST


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@xxxxxxxxxxxxxxx> 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? ;-)