Re: [PATCH] drm/mediatek: Don't print error if EDEFER_PROBE returned on component_add

From: Jonathan Cameron
Date: Thu Jun 06 2024 - 08:36:10 EST


On Wed, 05 Jun 2024 12:50:25 -0400
Nícolas F. R. A. Prado <nfraprado@xxxxxxxxxxxxx> wrote:

> Use dev_err_probe() in the component_add() error path to prevent
> printing an error when the probe is deferred. This was observed on
> mt8195 with the disp-rdma driver:
>
> mediatek-disp-rdma 1c002000.rdma: Failed to add component: -517
>
> But the same pattern is used across many other drivers, so update them
> all.
>
> Signed-off-by: Nícolas F. R. A. Prado <nfraprado@xxxxxxxxxxxxx>
> ---
> drivers/gpu/drm/mediatek/mtk_disp_aal.c | 2 +-
> drivers/gpu/drm/mediatek/mtk_disp_ccorr.c | 2 +-
> drivers/gpu/drm/mediatek/mtk_disp_color.c | 2 +-
> drivers/gpu/drm/mediatek/mtk_disp_gamma.c | 2 +-
> drivers/gpu/drm/mediatek/mtk_disp_merge.c | 2 +-
> drivers/gpu/drm/mediatek/mtk_disp_ovl.c | 2 +-
> drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c | 2 +-
> drivers/gpu/drm/mediatek/mtk_disp_rdma.c | 2 +-
> drivers/gpu/drm/mediatek/mtk_ethdr.c | 2 +-
> drivers/gpu/drm/mediatek/mtk_mdp_rdma.c | 2 +-
> 10 files changed, 10 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_disp_aal.c b/drivers/gpu/drm/mediatek/mtk_disp_aal.c
> index 3ce8f32b06d5..892dc40458fb 100644
> --- a/drivers/gpu/drm/mediatek/mtk_disp_aal.c
> +++ b/drivers/gpu/drm/mediatek/mtk_disp_aal.c
> @@ -197,7 +197,7 @@ static int mtk_disp_aal_probe(struct platform_device *pdev)
>
> ret = component_add(dev, &mtk_disp_aal_component_ops);
> if (ret)
> - dev_err(dev, "Failed to add component: %d\n", ret);
> + dev_err_probe(dev, ret, "Failed to add component\n");
Perhaps
return dev_err_probe(...)

return 0;

Whilst I can see you are focused on this one problem case, it
might be better to use dev_err_probe() for all the similar
cases earlier in these functions.

Then that return dev_err_probe() pattern will make more sense
as it will be consistent with all the other calls.