Commit b801a98f authored by Jani Nikula's avatar Jani Nikula

drm/i915/dpll: replace BUG_ON() with drm_WARN_ON()

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: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220830093411.1511040-2-jani.nikula@intel.com
parent 99f37216
...@@ -4199,6 +4199,10 @@ void intel_shared_dpll_init(struct drm_i915_private *dev_priv) ...@@ -4199,6 +4199,10 @@ void intel_shared_dpll_init(struct drm_i915_private *dev_priv)
dpll_info = dpll_mgr->dpll_info; dpll_info = dpll_mgr->dpll_info;
for (i = 0; dpll_info[i].name; i++) { 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;
drm_WARN_ON(&dev_priv->drm, i != dpll_info[i].id); drm_WARN_ON(&dev_priv->drm, i != dpll_info[i].id);
dev_priv->display.dpll.shared_dplls[i].info = &dpll_info[i]; 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) ...@@ -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.mgr = dpll_mgr;
dev_priv->display.dpll.num_shared_dpll = i; dev_priv->display.dpll.num_shared_dpll = i;
mutex_init(&dev_priv->display.dpll.lock); mutex_init(&dev_priv->display.dpll.lock);
BUG_ON(dev_priv->display.dpll.num_shared_dpll > I915_NUM_PLLS);
} }
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment