On Mon, Jun 15, 2026 at 04:38:19PM +0700, [email protected] wrote: > From: bui duc phuc <[email protected]> > > Clean up the code using guard() for mutex locks. > Merely code refactoring, and no behavior change. > > Signed-off-by: bui duc phuc <[email protected]> > ---
Reviewed-by: Frank Li <[email protected]> > sound/soc/fsl/fsl_ssi.c | 13 ++++--------- > 1 file changed, 4 insertions(+), 9 deletions(-) > > diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c > index b2e1da1781ae..dc022976c982 100644 > --- a/sound/soc/fsl/fsl_ssi.c > +++ b/sound/soc/fsl/fsl_ssi.c > @@ -1218,13 +1218,13 @@ static void fsl_ssi_ac97_write(struct snd_ac97 *ac97, > unsigned short reg, > if (reg > 0x7f) > return; > > - mutex_lock(&fsl_ac97_data->ac97_reg_lock); > + guard(mutex)(&fsl_ac97_data->ac97_reg_lock); > > ret = clk_prepare_enable(fsl_ac97_data->clk); > if (ret) { > pr_err("ac97 write clk_prepare_enable failed: %d\n", > ret); > - goto ret_unlock; > + return; > } > > lreg = reg << 12; > @@ -1238,9 +1238,6 @@ static void fsl_ssi_ac97_write(struct snd_ac97 *ac97, > unsigned short reg, > udelay(100); > > clk_disable_unprepare(fsl_ac97_data->clk); > - > -ret_unlock: > - mutex_unlock(&fsl_ac97_data->ac97_reg_lock); > } > > static unsigned short fsl_ssi_ac97_read(struct snd_ac97 *ac97, > @@ -1252,12 +1249,12 @@ static unsigned short fsl_ssi_ac97_read(struct > snd_ac97 *ac97, > unsigned int lreg; > int ret; > > - mutex_lock(&fsl_ac97_data->ac97_reg_lock); > + guard(mutex)(&fsl_ac97_data->ac97_reg_lock); > > ret = clk_prepare_enable(fsl_ac97_data->clk); > if (ret) { > pr_err("ac97 read clk_prepare_enable failed: %d\n", ret); > - goto ret_unlock; > + return val; > } > > lreg = (reg & 0x7f) << 12; > @@ -1272,8 +1269,6 @@ static unsigned short fsl_ssi_ac97_read(struct snd_ac97 > *ac97, > > clk_disable_unprepare(fsl_ac97_data->clk); > > -ret_unlock: > - mutex_unlock(&fsl_ac97_data->ac97_reg_lock); > return val; > } > > -- > 2.43.0 > >
