Re: [PATCH] iio: lmp91000: fix probe order and cleanup paths
From: Andy Shevchenko
Date: Wed May 06 2026 - 04:23:09 EST
On Wed, May 06, 2026 at 11:17:51AM +0300, Andy Shevchenko wrote:
> On Tue, May 05, 2026 at 08:46:24PM +0100, Salah Triki wrote:
> > Fix the initialization order in lmp91000_probe where the immutable trigger
>
> lmp91000_probe()
>
> > is set before data->cb_buffer is initialized, which would cause a NULL
> > pointer dereference.
> >
> > Also, correct the cleanup labels in the error path to properly unregister
> > the trigger before performing the triggered buffer cleanup, following the
> > standard LIFO (Last-In-First-Out) resource release order.
...
> > + data->cb_buffer = iio_channel_get_all_cb(dev, &lmp91000_buffer_cb,
> > + indio_dev);
>
> I would go with a single line here.
>
> > +
>
> Despite being in the original code, please drop this unneeded blank line.
>
> > + if (IS_ERR(data->cb_buffer)) {
> > + if (PTR_ERR(data->cb_buffer) == -ENODEV)
> > + ret = -EPROBE_DEFER;
> > + else
> > + ret = PTR_ERR(data->cb_buffer);
> > +
> > + goto error_unreg_buffer;
> > + }
On top of that fix the Subject as Joshua suggested in the other patch.
--
With Best Regards,
Andy Shevchenko