[PATCH] ASoC: meson: use dev_err_probe

Ricard Wanderlof ricardw at axis.com
Tue Nov 30 02:06:52 PST 2021


On Tue, 30 Nov 2021, Jerome Brunet wrote:

> Use dev_err_probe() helper function to handle probe deferral.
> It removes the open coded test for -EPROBE_DEFER but more importantly, it
> sets the deferral reason in debugfs which is great for debugging.
> 
> Signed-off-by: Jerome Brunet <jbrunet at baylibre.com>
> ---
>  sound/soc/meson/aiu.c               | 17 +++++++----------
>  sound/soc/meson/axg-fifo.c          |  9 +++------
>  sound/soc/meson/axg-pdm.c           |  9 +++------
>  sound/soc/meson/axg-spdifin.c       |  6 ++----
>  sound/soc/meson/axg-spdifout.c      |  6 ++----
>  sound/soc/meson/axg-tdm-formatter.c | 18 ++++++------------
>  sound/soc/meson/axg-tdm-interface.c |  9 +++------
>  sound/soc/meson/meson-card-utils.c  |  4 ++--
>  sound/soc/meson/t9015.c             |  8 ++++----
>  9 files changed, 32 insertions(+), 54 deletions(-)
> 
> diff --git a/sound/soc/meson/aiu.c b/sound/soc/meson/aiu.c
> index ba15d5762b0b..37036adf14ce 100644
> --- a/sound/soc/meson/aiu.c
> +++ b/sound/soc/meson/aiu.c
> @@ -219,31 +219,29 @@ static int aiu_clk_get(struct device *dev)
>  
>          aiu->pclk = devm_clk_get(dev, "pclk");
>          if (IS_ERR(aiu->pclk)) {
> -               if (PTR_ERR(aiu->pclk) != -EPROBE_DEFER)
> -                       dev_err(dev, "Can't get the aiu pclk\n");
> +               dev_err_probe(dev, PTR_ERR(aiu->pclk),
> +                             "Can't get the aiu pclk\n");
>                  return PTR_ERR(aiu->pclk);
>          }

A minor thing, but dev_err_probe returns its err argument, so this 
construct can be written more tersely as:

		return dev_err_probe(dev, PTR_ERR(aio->pclk),
                                     "Can't get the aio pclk\n");

and that also seems to be in common usage when browsing existing code.

/Ricard
-- 
Ricard Wolf Wanderlof                           ricardw(at)axis.com
Axis Communications AB, Lund, Sweden            www.axis.com
Phone +46 46 272 2016                           Fax +46 46 13 61 30



More information about the linux-amlogic mailing list