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

From: Dan Carpenter

Date: Tue Mar 10 2026 - 05:36:58 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>
> ---

We're only doing these conversions for new code or when we're fixing
bugs.

regards,
dan carpenter