Re: [PATCH] iio: gyro: mpu3050: add missing trigger cleanup on remove

From: Joshua Crofts

Date: Thu Oct 15 2026 - 16:06:22 EST


On Tue, 13 Oct 2026 13:30:32 +0100
Nuno Sá <nuno.sa@xxxxxxxxxx> wrote:

> On Sun, Oct 11, 2026 at 07:12:40PM +0200, Joshua Crofts wrote:
> > On Sun, 11 Oct 2026 17:53:01 +0200
> > Joshua Crofts <joshua.crofts1@xxxxxxxxx> wrote:
> > > drivers/iio/gyro/mpu3050-core.c | 4 ++++
> > > 1 file changed, 4 insertions(+)
> > >
> >
> > Sashiko review came back and the issue doesn't seem so
> > straight-forward. I'll probably introduce a local pointer
> > and then assign it to the mpu3050 data struct.
>
> Hmm the probe seems a mess of mixed devm with manual cleanup. Ideally we
> would move all of it managed resources (and that would fix the issue).
> Other than that, seems to me we have two things in play. First:
>
> if (irq) {
> ret = mpu3050_trigger_probe(indio_dev, irq);
> if (ret)
> dev_err(dev, "failed to register trigger\n");
> }
>
> Do we really want to ignore the error? I would say no...
> So, if we change the above to not ignore errors, we can assume that, on
> success, our trigger was registered. Which means that on the if (irq) at
> the errir patch we could unregister the trigger. Not that pretty but
> consistent with what we have :).

Ah well, I'm an idiot and pushed out a v2. This would make things
easier as the trigger would have been guaranteed to exist...

> If someone has the HW, moving this into devm would probably be the
> better approach (but even in that case, we might want the simple fix
> first for backporting).

I'd push the simple fix out, then move it to devm.

--
Kind regards,
Joshua Crofts