dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jordan Crouse <jcrouse-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
To: Jeykumar Sankaran <jsanka-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
Cc: linux-arm-msm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
	robdclark-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	seanpaul-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org,
	hoegsberg-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org,
	freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: Re: [PATCH v3 2/3] drm/msm/dpu: handle failures while initializing displays
Date: Fri, 14 Dec 2018 08:36:07 -0700	[thread overview]
Message-ID: <20181214153607.GD29770@jcrouse-lnx.qualcomm.com> (raw)
In-Reply-To: <1544727064-26763-2-git-send-email-jsanka-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>

On Thu, Dec 13, 2018 at 10:51:03AM -0800, Jeykumar Sankaran wrote:
> Bail out KMS hw init on display initialization failures with
> proper error logging.
> 
> changes in v3:
> 	- introduced in the series
> 
> Signed-off-by: Jeykumar Sankaran <jsanka@codeaurora.org>
> ---
>  drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 39 +++++++++++++++++++++++----------
>  1 file changed, 27 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
> index 685686e..39c8549 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
> @@ -405,33 +405,36 @@ static void dpu_kms_wait_for_commit_done(struct msm_kms *kms,
>  	}
>  }
>  
> -static void _dpu_kms_initialize_dsi(struct drm_device *dev,
> +static int _dpu_kms_initialize_dsi(struct drm_device *dev,
>  				    struct msm_drm_private *priv,
>  				    struct dpu_kms *dpu_kms)
>  {
>  	struct drm_encoder *encoder = NULL;
> -	int i, rc;
> +	int i, rc = 0;
> +
> +	if (!(priv->dsi[0] || priv->dsi[1]))
> +		return rc;
>  
>  	/*TODO: Support two independent DSI connectors */
>  	encoder = dpu_encoder_init(dev, DRM_MODE_ENCODER_DSI);
> -	if (IS_ERR_OR_NULL(encoder)) {
> +	if (IS_ERR(encoder)) {
>  		DPU_ERROR("encoder init failed for dsi display\n");
> -		return;
> +		return PTR_ERR(encoder);
>  	}
>  
>  	for (i = 0; i < ARRAY_SIZE(priv->dsi); i++) {
> -		if (!priv->dsi[i]) {
> -			DPU_DEBUG("invalid msm_dsi for ctrl %d\n", i);
> -			return;
> -		}
> +		if (!priv->dsi[i])
> +			continue;
>  
>  		rc = msm_dsi_modeset_init(priv->dsi[i], dev, encoder);
>  		if (rc) {
>  			DPU_ERROR("modeset_init failed for dsi[%d], rc = %d\n",
>  				i, rc);
> -			continue;
> +			return rc;
>  		}
>  	}
> +
> +	return rc;

This also looks like one of those cases where you can drop out of the if
statement to return rc.
>  }
>  
>  /**
> @@ -442,16 +445,24 @@ static void _dpu_kms_initialize_dsi(struct drm_device *dev,
>   * @dpu_kms:    Pointer to dpu kms structure
>   * Returns:     Zero on success
>   */
> -static void _dpu_kms_setup_displays(struct drm_device *dev,
> +static int _dpu_kms_setup_displays(struct drm_device *dev,
>  				    struct msm_drm_private *priv,
>  				    struct dpu_kms *dpu_kms)
>  {
> -	_dpu_kms_initialize_dsi(dev, priv, dpu_kms);
> +	int rc = 0;
> +
> +	rc = _dpu_kms_initialize_dsi(dev, priv, dpu_kms);
> +	if (rc) {
> +		DPU_ERROR("failed to initialize dsi, rc = %d\n", rc);
> +		return rc;
> +	}
>  
>  	/**
>  	 * Extend this function to initialize other
>  	 * types of displays
>  	 */
> +
> +	return rc;

Here too.

>  }
>  
>  static void _dpu_kms_drm_obj_destroy(struct dpu_kms *dpu_kms)
> @@ -517,7 +528,11 @@ static int _dpu_kms_drm_obj_init(struct dpu_kms *dpu_kms)
>  	 * Create encoder and query display drivers to create
>  	 * bridges and connectors
>  	 */
> -	_dpu_kms_setup_displays(dev, priv, dpu_kms);
> +	ret = _dpu_kms_setup_displays(dev, priv, dpu_kms);
> +	if (ret) {
> +		DPU_ERROR("failed to setup display, rc = %d\n", ret);

You don't need to pile on with another error message.

> +		goto fail;
> +	}
>  
>  	max_crtc_count = min(catalog->mixer_count,
>  			     (u32)dev->mode_config.num_encoder);

-- 
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project
_______________________________________________
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno

  parent reply	other threads:[~2018-12-14 15:36 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-13 18:51 [PATCH v3 1/3] drm/msm/dpu: fix documentation for intf_type Jeykumar Sankaran
     [not found] ` <1544727064-26763-1-git-send-email-jsanka-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-12-13 18:51   ` [PATCH v3 2/3] drm/msm/dpu: handle failures while initializing displays Jeykumar Sankaran
     [not found]     ` <1544727064-26763-2-git-send-email-jsanka-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-12-14 15:22       ` Sean Paul
2018-12-17 19:35         ` Jeykumar Sankaran
2018-12-17 20:27         ` Jeykumar Sankaran
2018-12-14 15:36       ` Jordan Crouse [this message]
2018-12-13 18:51   ` [PATCH v3 3/3] drm/msm/dpu: add display port support in DPU Jeykumar Sankaran
     [not found]     ` <1544727064-26763-3-git-send-email-jsanka-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-12-14 15:26       ` Sean Paul
2018-12-14 15:27       ` Jordan Crouse

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181214153607.GD29770@jcrouse-lnx.qualcomm.com \
    --to=jcrouse-sgv2jx0feol9jmxxk+q4oq@public.gmane.org \
    --cc=dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=hoegsberg-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
    --cc=jsanka-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org \
    --cc=linux-arm-msm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=robdclark-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=seanpaul-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox