diff mbox series

[15/39] drm: renesas: shmobile: Improve error handling

Message ID 100c650ab37ae09a142a93afa3734400a6a96757.1687423204.git.geert+renesas@glider.be (mailing list archive)
State New, archived
Headers show
Series drm: renesas: shmobile: Atomic conversion + DT support | expand

Commit Message

Geert Uytterhoeven June 22, 2023, 9:21 a.m. UTC
Prepare for DT conversion, where panel probe can be deferred, by
streamlining error propagation and handling:
  - Use dev_err_probe() to avoid printing error messages in case of
    probe deferral,
  - Propagate errors where needed.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 drivers/gpu/drm/renesas/shmobile/shmob_drm_drv.c |  3 ++-
 drivers/gpu/drm/renesas/shmobile/shmob_drm_kms.c | 14 +++++++++++---
 2 files changed, 13 insertions(+), 4 deletions(-)

Comments

Laurent Pinchart June 23, 2023, 3:41 p.m. UTC | #1
Hi Geert,

Thank you for the patch.

On Thu, Jun 22, 2023 at 11:21:27AM +0200, Geert Uytterhoeven wrote:
> Prepare for DT conversion, where panel probe can be deferred, by
> streamlining error propagation and handling:
>   - Use dev_err_probe() to avoid printing error messages in case of
>     probe deferral,
>   - Propagate errors where needed.
> 
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>

Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>

> ---
>  drivers/gpu/drm/renesas/shmobile/shmob_drm_drv.c |  3 ++-
>  drivers/gpu/drm/renesas/shmobile/shmob_drm_kms.c | 14 +++++++++++---
>  2 files changed, 13 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/renesas/shmobile/shmob_drm_drv.c b/drivers/gpu/drm/renesas/shmobile/shmob_drm_drv.c
> index 9aa9800899976a23..50fca18282c5cb5e 100644
> --- a/drivers/gpu/drm/renesas/shmobile/shmob_drm_drv.c
> +++ b/drivers/gpu/drm/renesas/shmobile/shmob_drm_drv.c
> @@ -228,7 +228,8 @@ static int shmob_drm_probe(struct platform_device *pdev)
>  
>  	ret = shmob_drm_modeset_init(sdev);
>  	if (ret < 0) {
> -		dev_err(&pdev->dev, "failed to initialize mode setting\n");
> +		dev_err_probe(&pdev->dev, ret,
> +			      "failed to initialize mode setting\n");
>  		goto err_free_drm_dev;
>  	}
>  
> diff --git a/drivers/gpu/drm/renesas/shmobile/shmob_drm_kms.c b/drivers/gpu/drm/renesas/shmobile/shmob_drm_kms.c
> index 3051318ddc7999bc..1a62e7f8a8a9e6df 100644
> --- a/drivers/gpu/drm/renesas/shmobile/shmob_drm_kms.c
> +++ b/drivers/gpu/drm/renesas/shmobile/shmob_drm_kms.c
> @@ -157,9 +157,17 @@ int shmob_drm_modeset_init(struct shmob_drm_device *sdev)
>  	if (ret)
>  		return ret;
>  
> -	shmob_drm_crtc_create(sdev);
> -	shmob_drm_encoder_create(sdev);
> -	shmob_drm_connector_create(sdev, &sdev->encoder);
> +	ret = shmob_drm_crtc_create(sdev);
> +	if (ret < 0)
> +		return ret;
> +
> +	ret = shmob_drm_encoder_create(sdev);
> +	if (ret < 0)
> +		return ret;
> +
> +	ret = shmob_drm_connector_create(sdev, &sdev->encoder);
> +	if (ret < 0)
> +		return ret;
>  
>  	drm_kms_helper_poll_init(sdev->ddev);
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/renesas/shmobile/shmob_drm_drv.c b/drivers/gpu/drm/renesas/shmobile/shmob_drm_drv.c
index 9aa9800899976a23..50fca18282c5cb5e 100644
--- a/drivers/gpu/drm/renesas/shmobile/shmob_drm_drv.c
+++ b/drivers/gpu/drm/renesas/shmobile/shmob_drm_drv.c
@@ -228,7 +228,8 @@  static int shmob_drm_probe(struct platform_device *pdev)
 
 	ret = shmob_drm_modeset_init(sdev);
 	if (ret < 0) {
-		dev_err(&pdev->dev, "failed to initialize mode setting\n");
+		dev_err_probe(&pdev->dev, ret,
+			      "failed to initialize mode setting\n");
 		goto err_free_drm_dev;
 	}
 
diff --git a/drivers/gpu/drm/renesas/shmobile/shmob_drm_kms.c b/drivers/gpu/drm/renesas/shmobile/shmob_drm_kms.c
index 3051318ddc7999bc..1a62e7f8a8a9e6df 100644
--- a/drivers/gpu/drm/renesas/shmobile/shmob_drm_kms.c
+++ b/drivers/gpu/drm/renesas/shmobile/shmob_drm_kms.c
@@ -157,9 +157,17 @@  int shmob_drm_modeset_init(struct shmob_drm_device *sdev)
 	if (ret)
 		return ret;
 
-	shmob_drm_crtc_create(sdev);
-	shmob_drm_encoder_create(sdev);
-	shmob_drm_connector_create(sdev, &sdev->encoder);
+	ret = shmob_drm_crtc_create(sdev);
+	if (ret < 0)
+		return ret;
+
+	ret = shmob_drm_encoder_create(sdev);
+	if (ret < 0)
+		return ret;
+
+	ret = shmob_drm_connector_create(sdev, &sdev->encoder);
+	if (ret < 0)
+		return ret;
 
 	drm_kms_helper_poll_init(sdev->ddev);