Re: [PATCH 03/15] iio: sx9310: Fix irq handling

From: Daniel Campello
Date: Tue Jul 28 2020 - 16:07:44 EST


On Tue, Jul 28, 2020 at 12:08 PM Andy Shevchenko
<andy.shevchenko@xxxxxxxxx> wrote:
>
> On Tue, Jul 28, 2020 at 6:14 PM Daniel Campello <campello@xxxxxxxxxxxx> wrote:
> >
> > Fixes enable/disable irq handling at various points. The driver needs to
> > only enable/disable irqs if there is an actual irq handler installed.
>
> > - enable_irq(data->client->irq);
> > + if (!ret)
> > + enable_irq(data->client->irq);
> >
> > return ret;
> > }
>
> Can it be a usual pattern?
>
> if (ret)
> return ret;
> ...
> return 0;

I think this way is more readable. The alternative would have to be
something like this:

....
if (ret)
goto out;
mutex_unlock(&data->mutex);
enable_irq(data->client->irq);
return 0;

out:
mutex_unlock(&data->mutex);
return ret;

>
> --
> With Best Regards,
> Andy Shevchenko

Regards,
Daniel Campello