public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@intel.com>
To: Andrzej Hajda <andrzej.hajda@intel.com>, intel-gfx@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH v2 2/5] drm/i915/dpll: replace BUG_ON() with drm_WARN_ON()
Date: Wed, 31 Aug 2022 18:55:46 +0300	[thread overview]
Message-ID: <87edwwcsql.fsf@intel.com> (raw)
In-Reply-To: <3745e576-3c2c-e643-67a5-d84f3a66c3d6@intel.com>

On Wed, 31 Aug 2022, Andrzej Hajda <andrzej.hajda@intel.com> wrote:
> On 30.08.2022 11:34, Jani Nikula wrote:
>> Avoid BUG_ON(). Actually check the dpll count and bail out loudly with
>> drm_WARN_ON() from the loop before overflowing
>> i915->dpll.shared_dplls[].
>> 
>> v2: Rebase
>> 
>> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
>> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
>> ---
>>   drivers/gpu/drm/i915/display/intel_dpll_mgr.c | 6 ++++--
>>   1 file changed, 4 insertions(+), 2 deletions(-)
>> 
>> diff --git a/drivers/gpu/drm/i915/display/intel_dpll_mgr.c b/drivers/gpu/drm/i915/display/intel_dpll_mgr.c
>> index bbe142056c7c..ed267c918009 100644
>> --- a/drivers/gpu/drm/i915/display/intel_dpll_mgr.c
>> +++ b/drivers/gpu/drm/i915/display/intel_dpll_mgr.c
>> @@ -4199,6 +4199,10 @@ void intel_shared_dpll_init(struct drm_i915_private *dev_priv)
>>   	dpll_info = dpll_mgr->dpll_info;
>>   
>>   	for (i = 0; dpll_info[i].name; i++) {
>> +		if (drm_WARN_ON(&dev_priv->drm,
>> +				i >= ARRAY_SIZE(dev_priv->display.dpll.shared_dplls)))
>> +			break;
>> +
>
> Shouldn't this check be replaced by some compile time checker.

Can't do that because the dpll_info arrays are null terminated.

> Anyway:
> Reviewed-by: Andrzej Hajda <andrzej.hajda@intel.com>

Thanks, but I just pushed the series as Ville already reviewed it.

BR,
Jani.


>
> Regards
> Andrzej
>
>
>>   		drm_WARN_ON(&dev_priv->drm, i != dpll_info[i].id);
>>   		dev_priv->display.dpll.shared_dplls[i].info = &dpll_info[i];
>>   	}
>> @@ -4206,8 +4210,6 @@ void intel_shared_dpll_init(struct drm_i915_private *dev_priv)
>>   	dev_priv->display.dpll.mgr = dpll_mgr;
>>   	dev_priv->display.dpll.num_shared_dpll = i;
>>   	mutex_init(&dev_priv->display.dpll.lock);
>> -
>> -	BUG_ON(dev_priv->display.dpll.num_shared_dpll > I915_NUM_PLLS);
>>   }
>>   
>>   /**
>

-- 
Jani Nikula, Intel Open Source Graphics Center

  reply	other threads:[~2022-08-31 15:56 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-30  9:34 [Intel-gfx] [PATCH v2 1/5] drm/i915/crt: remove BUG_ON() Jani Nikula
2022-08-30  9:34 ` [Intel-gfx] [PATCH v2 2/5] drm/i915/dpll: replace BUG_ON() with drm_WARN_ON() Jani Nikula
2022-08-31 15:44   ` Andrzej Hajda
2022-08-31 15:55     ` Jani Nikula [this message]
2022-08-30  9:34 ` [Intel-gfx] [PATCH v2 3/5] drm/i915/pch: " Jani Nikula
2022-08-31 15:45   ` Andrzej Hajda
2022-08-30  9:34 ` [Intel-gfx] [PATCH v2 4/5] drm/i915/perf: replace BUG_ON() with WARN_ON() Jani Nikula
2022-08-30  9:34 ` [Intel-gfx] [PATCH v2 5/5] drm/i915/fence: replace BUG_ON() with BUILD_BUG_ON() Jani Nikula
2022-08-30  9:50 ` [Intel-gfx] ✗ Fi.CI.SPARSE: warning for series starting with [v2,1/5] drm/i915/crt: remove BUG_ON() Patchwork
2022-08-30 10:03 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2022-08-31 13:30 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " Patchwork
2022-08-31 14:46 ` [Intel-gfx] [PATCH v2 1/5] " Ville Syrjälä
2022-08-31 15:30 ` Andrzej Hajda
2022-08-31 15:41   ` Jani Nikula

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=87edwwcsql.fsf@intel.com \
    --to=jani.nikula@intel.com \
    --cc=andrzej.hajda@intel.com \
    --cc=intel-gfx@lists.freedesktop.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