[PATCH 15/78] ASoC: codecs: cs42l43: Use guard() for mutex locks

Charles Keepax ckeepax at opensource.cirrus.com
Wed Jun 17 03:57:49 PDT 2026


On Wed, Jun 17, 2026 at 05:31:32PM +0700, phucduc.bui at gmail.com wrote:
> From: bui duc phuc <phucduc.bui at gmail.com>
> 
> Clean up the code using guard() for mutex locks.
> Merely code refactoring, and no behavior change.
> 
> Signed-off-by: bui duc phuc <phucduc.bui at gmail.com>
> ---
> @@ -913,17 +908,13 @@ int cs42l43_jack_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *u
>  	if (override >= e->items)
>  		return -EINVAL;
>  
> -	mutex_lock(&priv->jack_lock);
> +	guard(mutex)(&priv->jack_lock);

I believe you have to use scoped_guard here, as there is a return
from the function above, if memory serves it attempts to release
the mutex on that path despite it being above the guard.

Be worth having a quick scan through the rest of the series for
this as well.

Thanks,
Charles



More information about the linux-arm-kernel mailing list