[PATCH v2 0/2] ASoC: adau1372: Fix error handling in adau1372_set_power()

Jihed Chaibi posted 2 patches 1 week, 1 day ago
sound/soc/codecs/adau1372.c | 34 ++++++++++++++++++++++-----------
1 file changed, 24 insertions(+), 10 deletions(-)
[PATCH v2 0/2] ASoC: adau1372: Fix error handling in adau1372_set_power()
Posted by Jihed Chaibi 1 week, 1 day ago
adau1372_set_power() had two related error handling issues in its enable
path: clk_prepare_enable() was called but its return value discarded, and
adau1372_enable_pll() was a void function that silently swallowed lock
failures, leaving mclk enabled and adau1372->enabled set to true despite
the device being in a broken state.

Patch 1 fixes the unchecked clk_prepare_enable() by making
adau1372_set_power() return int and propagating the error.

Patch 2 converts adau1372_enable_pll() to return int and adds a full
unwind in adau1372_set_power() if PLL lock fails, reversing the regcache,
GPIO power-down, and clock state.

Changes in v2:
- [1/2]: No changes.
- [2/2]: Also unwind regcache and GPIO power-down state on PLL lock
  failure, as noted by Mark Brown.

Jihed Chaibi (2):
  ASoC: adau1372: Fix unchecked clk_prepare_enable() return value
  ASoC: adau1372: Fix clock leak on PLL lock failure

 sound/soc/codecs/adau1372.c | 34 ++++++++++++++++++++++-----------
 1 file changed, 24 insertions(+), 10 deletions(-)

--
2.47.3
Re: [PATCH v2 0/2] ASoC: adau1372: Fix error handling in adau1372_set_power()
Posted by Mark Brown 1 week ago
On Wed, 25 Mar 2026 22:07:02 +0100, Jihed Chaibi wrote:
> ASoC: adau1372: Fix error handling in adau1372_set_power()
> 
> adau1372_set_power() had two related error handling issues in its enable
> path: clk_prepare_enable() was called but its return value discarded, and
> adau1372_enable_pll() was a void function that silently swallowed lock
> failures, leaving mclk enabled and adau1372->enabled set to true despite
> the device being in a broken state.
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-7.0

Thanks!

[1/2] ASoC: adau1372: Fix unchecked clk_prepare_enable() return value
      https://git.kernel.org/broonie/sound/c/326fe8104a40
[2/2] ASoC: adau1372: Fix clock leak on PLL lock failure
      https://git.kernel.org/broonie/sound/c/bfe6a264effc

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark
Re: [PATCH v2 0/2] ASoC: adau1372: Fix error handling in adau1372_set_power()
Posted by Nuno Sá 1 week ago
On Wed, 2026-03-25 at 22:07 +0100, Jihed Chaibi wrote:
> adau1372_set_power() had two related error handling issues in its enable
> path: clk_prepare_enable() was called but its return value discarded, and
> adau1372_enable_pll() was a void function that silently swallowed lock
> failures, leaving mclk enabled and adau1372->enabled set to true despite
> the device being in a broken state.
> 
> Patch 1 fixes the unchecked clk_prepare_enable() by making
> adau1372_set_power() return int and propagating the error.
> 
> Patch 2 converts adau1372_enable_pll() to return int and adds a full
> unwind in adau1372_set_power() if PLL lock fails, reversing the regcache,
> GPIO power-down, and clock state.
> 
> Changes in v2:
> - [1/2]: No changes.
> - [2/2]: Also unwind regcache and GPIO power-down state on PLL lock
>   failure, as noted by Mark Brown.
> 
> Jihed Chaibi (2):
>   ASoC: adau1372: Fix unchecked clk_prepare_enable() return value
>   ASoC: adau1372: Fix clock leak on PLL lock failure
> 
>  sound/soc/codecs/adau1372.c | 34 ++++++++++++++++++++++-----------
>  1 file changed, 24 insertions(+), 10 deletions(-)
> 
> --
> 2.47.3

With proper tags:

Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Re: [PATCH v2 0/2] ASoC: adau1372: Fix error handling in adau1372_set_power()
Posted by Jihed Chaibi 1 week ago
On Thu, Mar 26, 2026 at 10:31 AM Nuno Sá <noname.nuno@gmail.com> wrote:
>
> On Wed, 2026-03-25 at 22:07 +0100, Jihed Chaibi wrote:
> > adau1372_set_power() had two related error handling issues in its enable
> > path: clk_prepare_enable() was called but its return value discarded, and
> > adau1372_enable_pll() was a void function that silently swallowed lock
> > failures, leaving mclk enabled and adau1372->enabled set to true despite
> > the device being in a broken state.
> >
> > Patch 1 fixes the unchecked clk_prepare_enable() by making
> > adau1372_set_power() return int and propagating the error.
> >
> > Patch 2 converts adau1372_enable_pll() to return int and adds a full
> > unwind in adau1372_set_power() if PLL lock fails, reversing the regcache,
> > GPIO power-down, and clock state.
> >
> > Changes in v2:
> > - [1/2]: No changes.
> > - [2/2]: Also unwind regcache and GPIO power-down state on PLL lock
> >   failure, as noted by Mark Brown.
> >
> > Jihed Chaibi (2):
> >   ASoC: adau1372: Fix unchecked clk_prepare_enable() return value
> >   ASoC: adau1372: Fix clock leak on PLL lock failure
> >
> >  sound/soc/codecs/adau1372.c | 34 ++++++++++++++++++++++-----------
> >  1 file changed, 24 insertions(+), 10 deletions(-)
> >
> > --
> > 2.47.3
>
> With proper tags:
>
> Reviewed-by: Nuno Sá <nuno.sa@analog.com>

Thanks for the review, Nuno.

Fixes tags for the series:

[v2 1/2] ASoC: adau1372: Fix unchecked clk_prepare_enable() return value
Fixes: 6cd4c6459e47 ("ASoC: Add ADAU1372 audio CODEC support")

[v2 2/2] ASoC: adau1372: Fix clock leak on PLL lock failure
Fixes: 6cd4c6459e47 ("ASoC: Add ADAU1372 audio CODEC support")