diff mbox series

[RFC,5/6] drm/i915: Add WARN_ON in intel_get_crtc_for_pipe()

Message ID 20200123132659.725-6-anshuman.gupta@intel.com (mailing list archive)
State New, archived
Headers show
Series 3 display pipes combination system support | expand

Commit Message

Gupta, Anshuman Jan. 23, 2020, 1:26 p.m. UTC
Add a WARN_ON for a disabled pipe in pipe_mask at
intel_get_crtc_for_pipe() function.

Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Anshuman Gupta <anshuman.gupta@intel.com>
---
 drivers/gpu/drm/i915/display/intel_display_types.h | 2 ++
 1 file changed, 2 insertions(+)

Comments

Ville Syrjala Jan. 23, 2020, 1:52 p.m. UTC | #1
On Thu, Jan 23, 2020 at 06:56:58PM +0530, Anshuman Gupta wrote:
> Add a WARN_ON for a disabled pipe in pipe_mask at
> intel_get_crtc_for_pipe() function.
> 
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Signed-off-by: Anshuman Gupta <anshuman.gupta@intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_display_types.h | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h b/drivers/gpu/drm/i915/display/intel_display_types.h
> index 33ba93863488..ca8d1e17814e 100644
> --- a/drivers/gpu/drm/i915/display/intel_display_types.h
> +++ b/drivers/gpu/drm/i915/display/intel_display_types.h
> @@ -1426,6 +1426,8 @@ vlv_pipe_to_channel(enum pipe pipe)
>  static inline struct intel_crtc *
>  intel_get_crtc_for_pipe(struct drm_i915_private *dev_priv, enum pipe pipe)
>  {
> +	/* pipe_to_crtc_mapping may have hole on any of 3 display pipe system */
> +	WARN_ON(!(INTEL_INFO(dev_priv)->pipe_mask & BIT(pipe)));

Sure. Might help catch accidents where the caller does a NULL check and
thus doesn't oops.

Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

>  	return dev_priv->pipe_to_crtc_mapping[pipe];
>  }
>  
> -- 
> 2.24.0
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/display/intel_display_types.h b/drivers/gpu/drm/i915/display/intel_display_types.h
index 33ba93863488..ca8d1e17814e 100644
--- a/drivers/gpu/drm/i915/display/intel_display_types.h
+++ b/drivers/gpu/drm/i915/display/intel_display_types.h
@@ -1426,6 +1426,8 @@  vlv_pipe_to_channel(enum pipe pipe)
 static inline struct intel_crtc *
 intel_get_crtc_for_pipe(struct drm_i915_private *dev_priv, enum pipe pipe)
 {
+	/* pipe_to_crtc_mapping may have hole on any of 3 display pipe system */
+	WARN_ON(!(INTEL_INFO(dev_priv)->pipe_mask & BIT(pipe)));
 	return dev_priv->pipe_to_crtc_mapping[pipe];
 }