Skip to content

Commit

Permalink
drm/i915/dpll: replace BUG_ON() with drm_WARN_ON()
Browse files Browse the repository at this point in the history
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>
Link: https://patchwork.freedesktop.org/patch/msgid/20220830093411.1511040-2-jani.nikula@intel.com
  • Loading branch information
Jani Nikula committed Aug 31, 2022
1 parent 99f3721 commit b801a98
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions drivers/gpu/drm/i915/display/intel_dpll_mgr.c
Original file line number Diff line number Diff line change
Expand Up @@ -4199,15 +4199,17 @@ 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;

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.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);
}

/**
Expand Down

0 comments on commit b801a98

Please sign in to comment.