diff mbox series

[v2,1/4] drm/bridge: imx8qxp-pxl2dpi: Use dev_err_probe

Message ID 20250107143900.988567-2-alexander.stein@ew.tq-group.com (mailing list archive)
State New
Headers show
Series dev_err_probe usage for imx8qxp DPU pipeline | expand

Commit Message

Alexander Stein Jan. 7, 2025, 2:38 p.m. UTC
This simplifies the code and gives additional information upon deferral.

Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
---
 drivers/gpu/drm/bridge/imx/imx8qxp-pxl2dpi.c | 26 ++++++--------------
 1 file changed, 7 insertions(+), 19 deletions(-)

Comments

Liu Ying Jan. 8, 2025, 3:22 a.m. UTC | #1
On 01/07/2025, Alexander Stein wrote:
> This simplifies the code and gives additional information upon deferral.
> 
> Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
> ---
>  drivers/gpu/drm/bridge/imx/imx8qxp-pxl2dpi.c | 26 ++++++--------------
>  1 file changed, 7 insertions(+), 19 deletions(-)
> 
> diff --git a/drivers/gpu/drm/bridge/imx/imx8qxp-pxl2dpi.c b/drivers/gpu/drm/bridge/imx/imx8qxp-pxl2dpi.c
> index 65cf3a6c8ec69..038eaff889bb7 100644
> --- a/drivers/gpu/drm/bridge/imx/imx8qxp-pxl2dpi.c
> +++ b/drivers/gpu/drm/bridge/imx/imx8qxp-pxl2dpi.c
> @@ -398,20 +398,12 @@ static int imx8qxp_pxl2dpi_bridge_probe(struct platform_device *pdev)
>  		return -ENOMEM;
>  
>  	p2d->regmap = syscon_node_to_regmap(np->parent);
> -	if (IS_ERR(p2d->regmap)) {
> -		ret = PTR_ERR(p2d->regmap);
> -		if (ret != -EPROBE_DEFER)
> -			DRM_DEV_ERROR(dev, "failed to get regmap: %d\n", ret);
> -		return ret;
> -	}
> +	if (IS_ERR(p2d->regmap))
> +		return dev_err_probe(dev, ret, "failed to get regmap\n");

s/ret/PTR_ERR(p2d->regmap)/

>  
>  	ret = imx_scu_get_handle(&p2d->ipc_handle);
> -	if (ret) {
> -		if (ret != -EPROBE_DEFER)
> -			DRM_DEV_ERROR(dev, "failed to get SCU ipc handle: %d\n",
> -				      ret);
> -		return ret;
> -	}
> +	if (ret)
> +		return dev_err_probe(dev, ret, "failed to get SCU ipc handle\n");
>  
>  	p2d->dev = dev;
>  
> @@ -422,13 +414,9 @@ static int imx8qxp_pxl2dpi_bridge_probe(struct platform_device *pdev)
>  	}
>  
>  	p2d->next_bridge = imx8qxp_pxl2dpi_find_next_bridge(p2d);
> -	if (IS_ERR(p2d->next_bridge)) {
> -		ret = PTR_ERR(p2d->next_bridge);
> -		if (ret != -EPROBE_DEFER)
> -			DRM_DEV_ERROR(dev, "failed to find next bridge: %d\n",
> -				      ret);
> -		return ret;
> -	}
> +	if (IS_ERR(p2d->next_bridge))
> +		return dev_err_probe(dev, PTR_ERR(p2d->next_bridge),
> +				     "failed to find next bridge\n");
>  
>  	ret = imx8qxp_pxl2dpi_set_pixel_link_sel(p2d);
>  	if (ret)

imx8qxp_pxl2dpi_parse_dt_companion() may return -EPROBE_DEFER too, so it needs
to be changed.
Alexander Stein Jan. 8, 2025, 9:36 a.m. UTC | #2
Hi,

Am Mittwoch, 8. Januar 2025, 04:22:19 CET schrieb Liu Ying:
> On 01/07/2025, Alexander Stein wrote:
> > This simplifies the code and gives additional information upon deferral.
> > 
> > Signed-off-by: Alexander Stein <alexander.stein@ew.tq-group.com>
> > ---
> >  drivers/gpu/drm/bridge/imx/imx8qxp-pxl2dpi.c | 26 ++++++--------------
> >  1 file changed, 7 insertions(+), 19 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/bridge/imx/imx8qxp-pxl2dpi.c b/drivers/gpu/drm/bridge/imx/imx8qxp-pxl2dpi.c
> > index 65cf3a6c8ec69..038eaff889bb7 100644
> > --- a/drivers/gpu/drm/bridge/imx/imx8qxp-pxl2dpi.c
> > +++ b/drivers/gpu/drm/bridge/imx/imx8qxp-pxl2dpi.c
> > @@ -398,20 +398,12 @@ static int imx8qxp_pxl2dpi_bridge_probe(struct platform_device *pdev)
> >  		return -ENOMEM;
> >  
> >  	p2d->regmap = syscon_node_to_regmap(np->parent);
> > -	if (IS_ERR(p2d->regmap)) {
> > -		ret = PTR_ERR(p2d->regmap);
> > -		if (ret != -EPROBE_DEFER)
> > -			DRM_DEV_ERROR(dev, "failed to get regmap: %d\n", ret);
> > -		return ret;
> > -	}
> > +	if (IS_ERR(p2d->regmap))
> > +		return dev_err_probe(dev, ret, "failed to get regmap\n");
> 
> s/ret/PTR_ERR(p2d->regmap)/

Thanks for the catch.

> >  
> >  	ret = imx_scu_get_handle(&p2d->ipc_handle);
> > -	if (ret) {
> > -		if (ret != -EPROBE_DEFER)
> > -			DRM_DEV_ERROR(dev, "failed to get SCU ipc handle: %d\n",
> > -				      ret);
> > -		return ret;
> > -	}
> > +	if (ret)
> > +		return dev_err_probe(dev, ret, "failed to get SCU ipc handle\n");
> >  
> >  	p2d->dev = dev;
> >  
> > @@ -422,13 +414,9 @@ static int imx8qxp_pxl2dpi_bridge_probe(struct platform_device *pdev)
> >  	}
> >  
> >  	p2d->next_bridge = imx8qxp_pxl2dpi_find_next_bridge(p2d);
> > -	if (IS_ERR(p2d->next_bridge)) {
> > -		ret = PTR_ERR(p2d->next_bridge);
> > -		if (ret != -EPROBE_DEFER)
> > -			DRM_DEV_ERROR(dev, "failed to find next bridge: %d\n",
> > -				      ret);
> > -		return ret;
> > -	}
> > +	if (IS_ERR(p2d->next_bridge))
> > +		return dev_err_probe(dev, PTR_ERR(p2d->next_bridge),
> > +				     "failed to find next bridge\n");
> >  
> >  	ret = imx8qxp_pxl2dpi_set_pixel_link_sel(p2d);
> >  	if (ret)
> 
> imx8qxp_pxl2dpi_parse_dt_companion() may return -EPROBE_DEFER too, so it needs
> to be changed.

True, I added a dev_err_probe to that function when companion bridge cannot
be found.

Best regards,
Alexander
kernel test robot Jan. 8, 2025, 11:06 a.m. UTC | #3
Hi Alexander,

kernel test robot noticed the following build warnings:

[auto build test WARNING on shawnguo/for-next]
[also build test WARNING on linus/master v6.13-rc6 next-20250107]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Alexander-Stein/drm-bridge-imx8qxp-pxl2dpi-Use-dev_err_probe/20250107-224125
base:   https://git.kernel.org/pub/scm/linux/kernel/git/shawnguo/linux.git for-next
patch link:    https://lore.kernel.org/r/20250107143900.988567-2-alexander.stein%40ew.tq-group.com
patch subject: [PATCH v2 1/4] drm/bridge: imx8qxp-pxl2dpi: Use dev_err_probe
config: arm-randconfig-004-20250108 (https://download.01.org/0day-ci/archive/20250108/202501081822.A69smnpW-lkp@intel.com/config)
compiler: clang version 18.1.8 (https://github.com/llvm/llvm-project 3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250108/202501081822.A69smnpW-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202501081822.A69smnpW-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/gpu/drm/bridge/imx/imx8qxp-pxl2dpi.c:402:29: warning: variable 'ret' is uninitialized when used here [-Wuninitialized]
     402 |                 return dev_err_probe(dev, ret, "failed to get regmap\n");
         |                                           ^~~
   drivers/gpu/drm/bridge/imx/imx8qxp-pxl2dpi.c:394:9: note: initialize the variable 'ret' to silence this warning
     394 |         int ret;
         |                ^
         |                 = 0
   1 warning generated.


vim +/ret +402 drivers/gpu/drm/bridge/imx/imx8qxp-pxl2dpi.c

   388	
   389	static int imx8qxp_pxl2dpi_bridge_probe(struct platform_device *pdev)
   390	{
   391		struct imx8qxp_pxl2dpi *p2d;
   392		struct device *dev = &pdev->dev;
   393		struct device_node *np = dev->of_node;
   394		int ret;
   395	
   396		p2d = devm_kzalloc(dev, sizeof(*p2d), GFP_KERNEL);
   397		if (!p2d)
   398			return -ENOMEM;
   399	
   400		p2d->regmap = syscon_node_to_regmap(np->parent);
   401		if (IS_ERR(p2d->regmap))
 > 402			return dev_err_probe(dev, ret, "failed to get regmap\n");
   403	
   404		ret = imx_scu_get_handle(&p2d->ipc_handle);
   405		if (ret)
   406			return dev_err_probe(dev, ret, "failed to get SCU ipc handle\n");
   407	
   408		p2d->dev = dev;
   409	
   410		ret = of_property_read_u32(np, "fsl,sc-resource", &p2d->sc_resource);
   411		if (ret) {
   412			DRM_DEV_ERROR(dev, "failed to get SC resource %d\n", ret);
   413			return ret;
   414		}
   415	
   416		p2d->next_bridge = imx8qxp_pxl2dpi_find_next_bridge(p2d);
   417		if (IS_ERR(p2d->next_bridge))
   418			return dev_err_probe(dev, PTR_ERR(p2d->next_bridge),
   419					     "failed to find next bridge\n");
   420	
   421		ret = imx8qxp_pxl2dpi_set_pixel_link_sel(p2d);
   422		if (ret)
   423			return ret;
   424	
   425		ret = imx8qxp_pxl2dpi_parse_dt_companion(p2d);
   426		if (ret)
   427			return ret;
   428	
   429		platform_set_drvdata(pdev, p2d);
   430		pm_runtime_enable(dev);
   431	
   432		p2d->bridge.driver_private = p2d;
   433		p2d->bridge.funcs = &imx8qxp_pxl2dpi_bridge_funcs;
   434		p2d->bridge.of_node = np;
   435	
   436		drm_bridge_add(&p2d->bridge);
   437	
   438		return ret;
   439	}
   440
diff mbox series

Patch

diff --git a/drivers/gpu/drm/bridge/imx/imx8qxp-pxl2dpi.c b/drivers/gpu/drm/bridge/imx/imx8qxp-pxl2dpi.c
index 65cf3a6c8ec69..038eaff889bb7 100644
--- a/drivers/gpu/drm/bridge/imx/imx8qxp-pxl2dpi.c
+++ b/drivers/gpu/drm/bridge/imx/imx8qxp-pxl2dpi.c
@@ -398,20 +398,12 @@  static int imx8qxp_pxl2dpi_bridge_probe(struct platform_device *pdev)
 		return -ENOMEM;
 
 	p2d->regmap = syscon_node_to_regmap(np->parent);
-	if (IS_ERR(p2d->regmap)) {
-		ret = PTR_ERR(p2d->regmap);
-		if (ret != -EPROBE_DEFER)
-			DRM_DEV_ERROR(dev, "failed to get regmap: %d\n", ret);
-		return ret;
-	}
+	if (IS_ERR(p2d->regmap))
+		return dev_err_probe(dev, ret, "failed to get regmap\n");
 
 	ret = imx_scu_get_handle(&p2d->ipc_handle);
-	if (ret) {
-		if (ret != -EPROBE_DEFER)
-			DRM_DEV_ERROR(dev, "failed to get SCU ipc handle: %d\n",
-				      ret);
-		return ret;
-	}
+	if (ret)
+		return dev_err_probe(dev, ret, "failed to get SCU ipc handle\n");
 
 	p2d->dev = dev;
 
@@ -422,13 +414,9 @@  static int imx8qxp_pxl2dpi_bridge_probe(struct platform_device *pdev)
 	}
 
 	p2d->next_bridge = imx8qxp_pxl2dpi_find_next_bridge(p2d);
-	if (IS_ERR(p2d->next_bridge)) {
-		ret = PTR_ERR(p2d->next_bridge);
-		if (ret != -EPROBE_DEFER)
-			DRM_DEV_ERROR(dev, "failed to find next bridge: %d\n",
-				      ret);
-		return ret;
-	}
+	if (IS_ERR(p2d->next_bridge))
+		return dev_err_probe(dev, PTR_ERR(p2d->next_bridge),
+				     "failed to find next bridge\n");
 
 	ret = imx8qxp_pxl2dpi_set_pixel_link_sel(p2d);
 	if (ret)