lkml.org 
[lkml]   [2020]   [Jul]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 03/15] iio: sx9310: Fix irq handling
From
Date
Quoting Daniel Campello (2020-07-28 13:07:00)
> On Tue, Jul 28, 2020 at 12:08 PM Andy Shevchenko
> <andy.shevchenko@gmail.com> wrote:
> >
> > On Tue, Jul 28, 2020 at 6:14 PM Daniel Campello <campello@chromium.org> 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;
>

I think the suggestion is

mutex_unlock(&data->mutex);
if (ret)
return ret;

enable_irq(data->client->irq);

return 0;

\
 
 \ /
  Last update: 2020-07-28 22:15    [W:0.379 / U:0.740 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site