Re: [PATCH] staging: rtl8723bs: convert mutex_lock/unlock to guard and scoped_guard in rtw_pwrctrl.c

From: Greg KH

Date: Tue Mar 10 2026 - 05:03:54 EST


On Tue, Mar 10, 2026 at 05:48:06AM -0300, Gustavo Arantes wrote:
> Replace simple mutex_lock()/mutex_unlock() pairs with guard(mutex)() and
> scoped_guard(mutex, ...) in rtw_pwrctrl.c, simplifying the locking by
> using cleanup.h guard API which automatically releases the mutex when the
> variable goes out of scope, reducing risks of missing unlocks on error
> paths.
>
> Signed-off-by: Gustavo Arantes <dev.gustavoa@xxxxxxxxx>

Let's not convert existing code to use guard(), but rather use it for
newer code submitted to the kernel.

thanks,

greg k-h