[2/2] drm/panel: ltk050h3146w: use dev_err_probe wherever possible

Message ID 20240104-ltk-dev_err_probe-v1-2-8ef3c0b585d8@theobroma-systems.com
State New
Headers
Series drm/panel: ltk050h3146w: error-path debug message improvements |

Commit Message

Quentin Schulz Jan. 4, 2024, 12:41 p.m. UTC
  From: Quentin Schulz <quentin.schulz@theobroma-systems.com>

This is only a cosmetic change.

This replaces a hand-crafted EPROBE_DEFER handling for deciding to print
an error message with dev_err_probe.

A side-effect is that dev_err_probe also adds a debug message when it's
not EPROBE_DEFER, but this is seen as an improvement.

Cc: Quentin Schulz <foss+kernel@0leil.net>
Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
---
 drivers/gpu/drm/panel/panel-leadtek-ltk050h3146w.c | 17 +++++------------
 1 file changed, 5 insertions(+), 12 deletions(-)


-- 
2.43.0
  

Comments

Christophe JAILLET Jan. 4, 2024, 2:08 p.m. UTC | #1
Le 04/01/2024 à 13:41, Quentin Schulz a écrit :
> From: Quentin Schulz <quentin.schulz@theobroma-systems.com>
> 
> This is only a cosmetic change.
> 
> This replaces a hand-crafted EPROBE_DEFER handling for deciding to print
> an error message with dev_err_probe.
> 
> A side-effect is that dev_err_probe also adds a debug message when it's
> not EPROBE_DEFER, but this is seen as an improvement.
> 
> Cc: Quentin Schulz <foss+kernel@0leil.net>
> Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>

Reviewed-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>

> ---
>   drivers/gpu/drm/panel/panel-leadtek-ltk050h3146w.c | 17 +++++------------
>   1 file changed, 5 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/gpu/drm/panel/panel-leadtek-ltk050h3146w.c b/drivers/gpu/drm/panel/panel-leadtek-ltk050h3146w.c
> index ecfa4181c4fd9..9d87cc1a357e3 100644
> --- a/drivers/gpu/drm/panel/panel-leadtek-ltk050h3146w.c
> +++ b/drivers/gpu/drm/panel/panel-leadtek-ltk050h3146w.c
> @@ -650,20 +650,13 @@ static int ltk050h3146w_probe(struct mipi_dsi_device *dsi)
>   		return dev_err_probe(dev, PTR_ERR(ctx->reset_gpio), "cannot get reset gpio\n");
>   
>   	ctx->vci = devm_regulator_get(dev, "vci");
> -	if (IS_ERR(ctx->vci)) {
> -		ret = PTR_ERR(ctx->vci);
> -		if (ret != -EPROBE_DEFER)
> -			dev_err(dev, "Failed to request vci regulator: %d\n", ret);
> -		return ret;
> -	}
> +	if (IS_ERR(ctx->vci))
> +		return dev_err_probe(dev, PTR_ERR(ctx->vci), "Failed to request vci regulator\n");
>   
>   	ctx->iovcc = devm_regulator_get(dev, "iovcc");
> -	if (IS_ERR(ctx->iovcc)) {
> -		ret = PTR_ERR(ctx->iovcc);
> -		if (ret != -EPROBE_DEFER)
> -			dev_err(dev, "Failed to request iovcc regulator: %d\n", ret);
> -		return ret;
> -	}
> +	if (IS_ERR(ctx->iovcc))
> +		return dev_err_probe(dev, PTR_ERR(ctx->iovcc),
> +				     "Failed to request iovcc regulator\n");
>   
>   	mipi_dsi_set_drvdata(dsi, ctx);
>   
>
  

Patch

diff --git a/drivers/gpu/drm/panel/panel-leadtek-ltk050h3146w.c b/drivers/gpu/drm/panel/panel-leadtek-ltk050h3146w.c
index ecfa4181c4fd9..9d87cc1a357e3 100644
--- a/drivers/gpu/drm/panel/panel-leadtek-ltk050h3146w.c
+++ b/drivers/gpu/drm/panel/panel-leadtek-ltk050h3146w.c
@@ -650,20 +650,13 @@  static int ltk050h3146w_probe(struct mipi_dsi_device *dsi)
 		return dev_err_probe(dev, PTR_ERR(ctx->reset_gpio), "cannot get reset gpio\n");
 
 	ctx->vci = devm_regulator_get(dev, "vci");
-	if (IS_ERR(ctx->vci)) {
-		ret = PTR_ERR(ctx->vci);
-		if (ret != -EPROBE_DEFER)
-			dev_err(dev, "Failed to request vci regulator: %d\n", ret);
-		return ret;
-	}
+	if (IS_ERR(ctx->vci))
+		return dev_err_probe(dev, PTR_ERR(ctx->vci), "Failed to request vci regulator\n");
 
 	ctx->iovcc = devm_regulator_get(dev, "iovcc");
-	if (IS_ERR(ctx->iovcc)) {
-		ret = PTR_ERR(ctx->iovcc);
-		if (ret != -EPROBE_DEFER)
-			dev_err(dev, "Failed to request iovcc regulator: %d\n", ret);
-		return ret;
-	}
+	if (IS_ERR(ctx->iovcc))
+		return dev_err_probe(dev, PTR_ERR(ctx->iovcc),
+				     "Failed to request iovcc regulator\n");
 
 	mipi_dsi_set_drvdata(dsi, ctx);