iio: frequency: adf4377: replace mutex_lock/unlock with guard(mutex)()

Replace manual mutex_lock()/mutex_unlock() calls with guard(mutex)() from
cleanup.h.

Using guard(mutex)() from cleanup.h allows the compiler to enforce lock
release on every exit path, eliminating the error-prone manual lock/unlock
pattern and the goto-based exit labels that existed in adf4377_get_freq()
and adf4377_set_freq(). This reduces the chance of lock imbalance bugs.

Signed-off-by: Eduardo Guedes <educg550@usp.br>
Co-developed-by: Lucca Ciriac <luccaciriac@usp.br>
Signed-off-by: Lucca Ciriac <luccaciriac@usp.br>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
This commit is contained in:
Eduardo Guedes 2026-06-10 10:23:37 -03:00 • committed by Jonathan Cameron
commit f0b9af3865