Re: [PATCH -next] iio: core: fix missing mutex_unlock() in iio_device_claim_buffer_mode()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 2022-11-04 at 14:52 +0200, Andy Shevchenko wrote:
> On Fri, Nov 4, 2022 at 1:11 PM Nuno Sá <noname.nuno@xxxxxxxxx> wrote:
> > On Fri, 2022-11-04 at 11:54 +0200, Andy Shevchenko wrote:
> > > On Fri, Nov 4, 2022 at 11:05 AM Peng Wu <wupeng58@xxxxxxxxxx>
> > > wrote:
> > > > 
> > > > In the success path of iio_device_claim_buffer_mode(),
> > > > mutex_unlock()
> > > > should be called before return.
> > > 
> > > Please, understand how the code works.
> > > NAK.
> > > 
> > > Nuno, perhaps we need to put a comment inside the function to
> > > explain
> > > this?
> > > 
> > 
> > Hmm... I guess we can do that but, honestly, the docs in the
> > function
> > should be pretty straight. Maybe saying that it's supposed to work
> > as
> > iio_device_claim_direct_mode() would help (as that one is
> > familiar)...
> > 
> > Alternatively, having sparse annotations could also make it more
> > easy
> > to understand the intent.
> 
> Maybe simply
> 
> /* Yes, we leave it locked here */
> 
> before return 0; would suffice?

Yes, I think so...

- Nuno Sá





[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux