[PATCH 0/5] ASoC: mediatek: mt8186: Fix clock error handling

phucduc.bui@gmail.com posted 5 patches 1 month, 1 week ago
There is a newer version of this series
sound/soc/mediatek/mt8186/mt8186-afe-clk.c | 112 ++++++++++++++-------
1 file changed, 74 insertions(+), 38 deletions(-)
[PATCH 0/5] ASoC: mediatek: mt8186: Fix clock error handling
Posted by phucduc.bui@gmail.com 1 month, 1 week ago
From: bui duc phuc <phucduc.bui@gmail.com>

Hi all,

This series fixes error handling in the MT8186 AFE clock code.

The current code can return from clock operations without cleaning up
clocks that were already enabled, and can ignore clock lookup errors
while later using the affected clock pointers.

This series keeps devm_clk_get() and propagates clock lookup errors
instead of silently continuing with a NULL clock.

The changes therefore assume that the clocks used by the driver are
required. If these clocks are intended to be optional and
devm_clk_get_optional() is preferred, the clock users would also need
to check for missing clocks before calling clock APIs such as
clk_prepare_enable(), clk_disable_unprepare(), and clk_set_parent().

If that is the preferred approach, I can rework the series accordingly.

The changes were found by manual code inspection and compile-tested
only.

Best regards,
Phuc


bui duc phuc (5):
  ASoC: mediatek: mt8186: fix APLL mux setting error handling
  ASoC: mediatek: mt8186: Fix AFE clock error handling
  ASoC: mediatek: mt8186: Fix APLL enable error handling
  ASoC: mediatek: mt8186: Fix MCK error handling
  ASoC: mediatek: mt8186: Propagate clock lookup errors

 sound/soc/mediatek/mt8186/mt8186-afe-clk.c | 112 ++++++++++++++-------
 1 file changed, 74 insertions(+), 38 deletions(-)

-- 
2.43.0
Re: [PATCH 0/5] ASoC: mediatek: mt8186: Fix clock error handling
Posted by Bui Duc Phuc 1 month, 1 week ago
> The changes therefore assume that the clocks used by the driver are
> required. If these clocks are intended to be optional and
> devm_clk_get_optional() is preferred, the clock users would also need
> to check for missing clocks before calling clock APIs such as
> clk_prepare_enable(), clk_disable_unprepare(), and clk_set_parent().
>
> If that is the preferred approach, I can rework the series accordingly.


I apologize for the confusion. clk_prepare_enable(), clk_disable_unprepare(),
and clk_set_parent() already handle missing clocks and return 0 in that case.

So I only need to confirm whether an optional clock is intended to be used here,
so that I can revise the patch series accordingly.

Best regards,
Phuc