[PATCH 04/10] ASoC: rockchip: spdif: Use dev_err_probe

Sebastian Reichel posted 10 patches 1 week, 6 days ago
There is a newer version of this series
[PATCH 04/10] ASoC: rockchip: spdif: Use dev_err_probe
Posted by Sebastian Reichel 1 week, 6 days ago
Cleanup the probe routine a little bit by using dev_err_probe
instead of dev_err.

Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
---
 sound/soc/rockchip/rockchip_spdif.c | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/sound/soc/rockchip/rockchip_spdif.c b/sound/soc/rockchip/rockchip_spdif.c
index 841ef499ed7f..20ed64c1fa42 100644
--- a/sound/soc/rockchip/rockchip_spdif.c
+++ b/sound/soc/rockchip/rockchip_spdif.c
@@ -279,11 +279,9 @@ static int rk_spdif_probe(struct platform_device *pdev)
 		struct regmap *grf;
 
 		grf = syscon_regmap_lookup_by_phandle(np, "rockchip,grf");
-		if (IS_ERR(grf)) {
-			dev_err(&pdev->dev,
+		if (IS_ERR(grf))
+			return dev_err_probe(&pdev->dev, PTR_ERR(grf),
 				"rockchip_spdif missing 'rockchip,grf'\n");
-			return PTR_ERR(grf);
-		}
 
 		/* Select the 8 channel SPDIF solution on RK3288 as
 		 * the 2 channel one does not appear to work
@@ -334,16 +332,12 @@ static int rk_spdif_probe(struct platform_device *pdev)
 	ret = devm_snd_soc_register_component(&pdev->dev,
 					      &rk_spdif_component,
 					      &rk_spdif_dai, 1);
-	if (ret) {
-		dev_err(&pdev->dev, "Could not register DAI\n");
-		return ret;
-	}
+	if (ret)
+		return dev_err_probe(&pdev->dev, ret, "Could not register DAI\n");
 
 	ret = devm_snd_dmaengine_pcm_register(&pdev->dev, NULL, 0);
-	if (ret) {
-		dev_err(&pdev->dev, "Could not register PCM\n");
-		return ret;
-	}
+	if (ret)
+		dev_err_probe(&pdev->dev, ret, "Could not register PCM\n");
 
 	return 0;
 }

-- 
2.51.0
Re: [PATCH 04/10] ASoC: rockchip: spdif: Use dev_err_probe
Posted by Alexey Charkov 1 week, 6 days ago
Hi Sebastian,

On Tue, Jan 27, 2026 at 8:08 PM Sebastian Reichel
<sebastian.reichel@collabora.com> wrote:
>
> Cleanup the probe routine a little bit by using dev_err_probe
> instead of dev_err.
>
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> ---
>  sound/soc/rockchip/rockchip_spdif.c | 18 ++++++------------
>  1 file changed, 6 insertions(+), 12 deletions(-)
>
> diff --git a/sound/soc/rockchip/rockchip_spdif.c b/sound/soc/rockchip/rockchip_spdif.c
> index 841ef499ed7f..20ed64c1fa42 100644
> --- a/sound/soc/rockchip/rockchip_spdif.c
> +++ b/sound/soc/rockchip/rockchip_spdif.c
> @@ -279,11 +279,9 @@ static int rk_spdif_probe(struct platform_device *pdev)
>                 struct regmap *grf;
>
>                 grf = syscon_regmap_lookup_by_phandle(np, "rockchip,grf");
> -               if (IS_ERR(grf)) {
> -                       dev_err(&pdev->dev,
> +               if (IS_ERR(grf))
> +                       return dev_err_probe(&pdev->dev, PTR_ERR(grf),
>                                 "rockchip_spdif missing 'rockchip,grf'\n");
> -                       return PTR_ERR(grf);
> -               }
>
>                 /* Select the 8 channel SPDIF solution on RK3288 as
>                  * the 2 channel one does not appear to work
> @@ -334,16 +332,12 @@ static int rk_spdif_probe(struct platform_device *pdev)
>         ret = devm_snd_soc_register_component(&pdev->dev,
>                                               &rk_spdif_component,
>                                               &rk_spdif_dai, 1);
> -       if (ret) {
> -               dev_err(&pdev->dev, "Could not register DAI\n");
> -               return ret;
> -       }
> +       if (ret)
> +               return dev_err_probe(&pdev->dev, ret, "Could not register DAI\n");
>
>         ret = devm_snd_dmaengine_pcm_register(&pdev->dev, NULL, 0);
> -       if (ret) {
> -               dev_err(&pdev->dev, "Could not register PCM\n");
> -               return ret;
> -       }
> +       if (ret)
> +               dev_err_probe(&pdev->dev, ret, "Could not register PCM\n");

Shouldn't this one return the error code, instead of falling through
to 'return 0'?

>         return 0;
>  }
>
> --
> 2.51.0
>

Best regards,
Alexey
Re: [PATCH 04/10] ASoC: rockchip: spdif: Use dev_err_probe
Posted by Sebastian Reichel 1 week, 5 days ago
Hello Alexey,

On Tue, Jan 27, 2026 at 09:31:18PM +0400, Alexey Charkov wrote:
> >         ret = devm_snd_dmaengine_pcm_register(&pdev->dev, NULL, 0);
> > -       if (ret) {
> > -               dev_err(&pdev->dev, "Could not register PCM\n");
> > -               return ret;
> > -       }
> > +       if (ret)
> > +               dev_err_probe(&pdev->dev, ret, "Could not register PCM\n");
> 
> Shouldn't this one return the error code, instead of falling through
> to 'return 0'?

Yes, good catch. I will fix that up in v2.

Thanks,

-- Sebastian