[PATCH] ASoC: meson: use dev_err_probe
Jerome Brunet
jbrunet at baylibre.com
Tue May 25 09:25:47 CEST 2021
On Tue 25 May 2021 at 02:07, Joe Perches <joe at perches.com> wrote:
> On Mon, 2021-05-24 at 18:51 +0200, 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.
>
> trivia:
>
> It seems that the use of %ld, PTR_ERR(<foo>) isn't particularly
> useful now as dev_err_probe already uses %pe to emit descriptive
> error messages.
Indeed. I'll update. Thx for pointing this out.
>
>
>> diff --git a/sound/soc/meson/axg-fifo.c b/sound/soc/meson/axg-fifo.c
> []
>> @@ -352,17 +352,16 @@ int axg_fifo_probe(struct platform_device *pdev)
>>
>>
>> fifo->pclk = devm_clk_get(dev, NULL);
>> if (IS_ERR(fifo->pclk)) {
>> - if (PTR_ERR(fifo->pclk) != -EPROBE_DEFER)
>> - dev_err(dev, "failed to get pclk: %ld\n",
>> - PTR_ERR(fifo->pclk));
>> + dev_err_probe(dev, PTR_ERR(fifo->pclk),
>> + "failed to get pclk: %ld\n", PTR_ERR(fifo->pclk));
>
> here.
>
>> return PTR_ERR(fifo->pclk);
>> }
>>
>>
>> fifo->arb = devm_reset_control_get_exclusive(dev, NULL);
>> if (IS_ERR(fifo->arb)) {
>> - if (PTR_ERR(fifo->arb) != -EPROBE_DEFER)
>> - dev_err(dev, "failed to get arb reset: %ld\n",
>> - PTR_ERR(fifo->arb));
>> + dev_err_probe(dev, PTR_ERR(fifo->arb),
>> + "failed to get arb reset: %ld\n",
>> + PTR_ERR(fifo->arb));
>
> etc...
More information about the Alsa-devel
mailing list