提交 31941024 编写于 作者: J Jani Nikula

drm/i915/dp: use known correct array size in rate_to_index

I can't think of a real world bug this could cause now, but this will be
required in follow-up work. While at it, change the parameter order to
be slightly more sensible.

Cc: Manasi Navare <manasi.d.navare@intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Reviewed-by: NManasi Navare <manasi.d.navare@intel.com>
Signed-off-by: NJani Nikula <jani.nikula@intel.com>
Link: http://patchwork.freedesktop.org/patch/msgid/ff5b08f45a72c2247f5326b080027e2f5d8cc4ee.1490712890.git.jani.nikula@intel.com
上级 fd089233
...@@ -1538,12 +1538,12 @@ bool intel_dp_read_desc(struct intel_dp *intel_dp) ...@@ -1538,12 +1538,12 @@ bool intel_dp_read_desc(struct intel_dp *intel_dp)
return true; return true;
} }
static int rate_to_index(int find, const int *rates) static int rate_to_index(const int *rates, int len, int rate)
{ {
int i = 0; int i;
for (i = 0; i < DP_MAX_SUPPORTED_RATES; ++i) for (i = 0; i < len; i++)
if (find == rates[i]) if (rate == rates[i])
break; break;
return i; return i;
...@@ -1564,7 +1564,8 @@ intel_dp_max_link_rate(struct intel_dp *intel_dp) ...@@ -1564,7 +1564,8 @@ intel_dp_max_link_rate(struct intel_dp *intel_dp)
int intel_dp_rate_select(struct intel_dp *intel_dp, int rate) int intel_dp_rate_select(struct intel_dp *intel_dp, int rate)
{ {
return rate_to_index(rate, intel_dp->sink_rates); return rate_to_index(intel_dp->sink_rates, intel_dp->num_sink_rates,
rate);
} }
void intel_dp_compute_rate(struct intel_dp *intel_dp, int port_clock, void intel_dp_compute_rate(struct intel_dp *intel_dp, int port_clock,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册