[Intel-gfx] [PATCH 1/5] drm/i915/crt: replace BUG_ON() with drm_WARN_ON()

Ville Syrjälä ville.syrjala at linux.intel.com
Fri Aug 26 10:59:47 UTC 2022


On Fri, Aug 26, 2022 at 11:38:13AM +0300, Jani Nikula wrote:
> Avoid BUG_ON(). Replace with drm_WARN_ON() and early return.
> 
> Signed-off-by: Jani Nikula <jani.nikula at intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_crt.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/display/intel_crt.c b/drivers/gpu/drm/i915/display/intel_crt.c
> index 6a3893c8ff22..b92e2d0d14ea 100644
> --- a/drivers/gpu/drm/i915/display/intel_crt.c
> +++ b/drivers/gpu/drm/i915/display/intel_crt.c
> @@ -643,7 +643,8 @@ static bool intel_crt_detect_ddc(struct drm_connector *connector)
>  	struct i2c_adapter *i2c;
>  	bool ret = false;
>  
> -	BUG_ON(crt->base.type != INTEL_OUTPUT_ANALOG);
> +	if (drm_WARN_ON(&dev_priv->drm, crt->base.type != INTEL_OUTPUT_ANALOG))
> +		return false;

I'd just rip that out entirely. We don't have such checks anywhere else
eitheer.

>  
>  	i2c = intel_gmbus_get_adapter(dev_priv, dev_priv->vbt.crt_ddc_pin);
>  	edid = intel_crt_get_edid(connector, i2c);
> -- 
> 2.34.1

-- 
Ville Syrjälä
Intel


More information about the Intel-gfx mailing list