Re: [PATCH v2] iio: adc: ad7280a: replace mutex_lock() with guard(mutex)
From: Andy Shevchenko
Date: Tue Mar 31 2026 - 15:27:16 EST
On Tue, Mar 31, 2026 at 12:31:59PM -0300, Matheus Giarola wrote:
> Use guard(mutex) instead of mutex_lock()/mutex_unlock(),
> ensuring the mutex is released automatically when leaving
> the function scope. The change improves error handling and
> avoids issues such as missing unlocks. It also simplifies the
> code by removing 'err_unlock' label and several mutex_unlock()
> calls.
>
> As suggested, in ad7280_read_raw(), wrap the IIO_CHAN_INFO_RAW
> case in braces, providing a scope for the implicit variable
> declared by guard(mutex).
...
> Reported-by: kernel test robot <lkp@xxxxxxxxx>
> Closes: https://lore.kernel.org/oe-kbuild-all/202603210357.KTWqlL36-lkp@xxxxxxxxx/
> Closes: https://lore.kernel.org/oe-kbuild-all/202603210411.t4KwH3aX-lkp@xxxxxxxxx/
It can't be right. The bugs LKP reported are in your patch and not in the Linux
kernel as of today.
--
With Best Regards,
Andy Shevchenko