diff mbox series

[v2,3/4] drm/bridge: imx-ldb-helper: Use dev_err_probe

Message ID 20250107143900.988567-4-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/imx-ldb-helper.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

Comments

Liu Ying Jan. 8, 2025, 3:37 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/imx-ldb-helper.c | 13 ++++---------
>  1 file changed, 4 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/gpu/drm/bridge/imx/imx-ldb-helper.c b/drivers/gpu/drm/bridge/imx/imx-ldb-helper.c
> index 9b5bebbe357dd..2c9b862af74af 100644
> --- a/drivers/gpu/drm/bridge/imx/imx-ldb-helper.c
> +++ b/drivers/gpu/drm/bridge/imx/imx-ldb-helper.c
> @@ -167,7 +167,7 @@ int ldb_find_next_bridge_helper(struct ldb *ldb)
>  {
>  	struct device *dev = ldb->dev;
>  	struct ldb_channel *ldb_ch;
> -	int ret, i;
> +	int i;
>  
>  	for (i = 0; i < MAX_LDB_CHAN_NUM; i++) {
>  		ldb_ch = ldb->channel[i];
> @@ -177,14 +177,9 @@ int ldb_find_next_bridge_helper(struct ldb *ldb)
>  
>  		ldb_ch->next_bridge = devm_drm_of_get_bridge(dev, ldb_ch->np,
>  							     1, 0);
> -		if (IS_ERR(ldb_ch->next_bridge)) {
> -			ret = PTR_ERR(ldb_ch->next_bridge);
> -			if (ret != -EPROBE_DEFER)
> -				DRM_DEV_ERROR(dev,
> -					      "failed to get next bridge: %d\n",
> -					      ret);
> -			return ret;
> -		}
> +		if (IS_ERR(ldb_ch->next_bridge))
> +			return dev_err_probe(dev, PTR_ERR(ldb_ch->next_bridge),
> +					     "failed to find next bridge\n");

Nit: s/find/get/, since "get" was used.

>  	}
>  
>  	return 0;

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

Am Mittwoch, 8. Januar 2025, 04:37:55 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/imx-ldb-helper.c | 13 ++++---------
> >  1 file changed, 4 insertions(+), 9 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/bridge/imx/imx-ldb-helper.c b/drivers/gpu/drm/bridge/imx/imx-ldb-helper.c
> > index 9b5bebbe357dd..2c9b862af74af 100644
> > --- a/drivers/gpu/drm/bridge/imx/imx-ldb-helper.c
> > +++ b/drivers/gpu/drm/bridge/imx/imx-ldb-helper.c
> > @@ -167,7 +167,7 @@ int ldb_find_next_bridge_helper(struct ldb *ldb)
> >  {
> >  	struct device *dev = ldb->dev;
> >  	struct ldb_channel *ldb_ch;
> > -	int ret, i;
> > +	int i;
> >  
> >  	for (i = 0; i < MAX_LDB_CHAN_NUM; i++) {
> >  		ldb_ch = ldb->channel[i];
> > @@ -177,14 +177,9 @@ int ldb_find_next_bridge_helper(struct ldb *ldb)
> >  
> >  		ldb_ch->next_bridge = devm_drm_of_get_bridge(dev, ldb_ch->np,
> >  							     1, 0);
> > -		if (IS_ERR(ldb_ch->next_bridge)) {
> > -			ret = PTR_ERR(ldb_ch->next_bridge);
> > -			if (ret != -EPROBE_DEFER)
> > -				DRM_DEV_ERROR(dev,
> > -					      "failed to get next bridge: %d\n",
> > -					      ret);
> > -			return ret;
> > -		}
> > +		if (IS_ERR(ldb_ch->next_bridge))
> > +			return dev_err_probe(dev, PTR_ERR(ldb_ch->next_bridge),
> > +					     "failed to find next bridge\n");
> 
> Nit: s/find/get/, since "get" was used.

Thanks, you are right here. Adjusted.

> >  	}
> >  
> >  	return 0;
> 
> ldb_init_helper() may return -EPROBE_DEFER too, so it needs to be changed.

Thanks for spotting. Added dev_err_probe there as well.

Best regards,
Alexander
diff mbox series

Patch

diff --git a/drivers/gpu/drm/bridge/imx/imx-ldb-helper.c b/drivers/gpu/drm/bridge/imx/imx-ldb-helper.c
index 9b5bebbe357dd..2c9b862af74af 100644
--- a/drivers/gpu/drm/bridge/imx/imx-ldb-helper.c
+++ b/drivers/gpu/drm/bridge/imx/imx-ldb-helper.c
@@ -167,7 +167,7 @@  int ldb_find_next_bridge_helper(struct ldb *ldb)
 {
 	struct device *dev = ldb->dev;
 	struct ldb_channel *ldb_ch;
-	int ret, i;
+	int i;
 
 	for (i = 0; i < MAX_LDB_CHAN_NUM; i++) {
 		ldb_ch = ldb->channel[i];
@@ -177,14 +177,9 @@  int ldb_find_next_bridge_helper(struct ldb *ldb)
 
 		ldb_ch->next_bridge = devm_drm_of_get_bridge(dev, ldb_ch->np,
 							     1, 0);
-		if (IS_ERR(ldb_ch->next_bridge)) {
-			ret = PTR_ERR(ldb_ch->next_bridge);
-			if (ret != -EPROBE_DEFER)
-				DRM_DEV_ERROR(dev,
-					      "failed to get next bridge: %d\n",
-					      ret);
-			return ret;
-		}
+		if (IS_ERR(ldb_ch->next_bridge))
+			return dev_err_probe(dev, PTR_ERR(ldb_ch->next_bridge),
+					     "failed to find next bridge\n");
 	}
 
 	return 0;