Re: [PATCH] staging: iio: frequency: ad9834: use guard() for mutex locking

From: Greg Kroah-Hartman

Date: Thu Jun 25 2026 - 08:58:09 EST


On Thu, Jun 25, 2026 at 03:04:55PM +0300, Batu Ada Tutkun wrote:
> Replace manual mutex_lock()/mutex_unlock() pairs with guard(mutex) in
> ad9834_write() and ad9834_store_wavetype(). The mutex is now released
> automatically when each function returns, removing the need for
> explicit unlock calls.

You only need to do this for new code, no need to change existing code
unless you are fixing a bug by using guard().

thanks,

greg k-h