drm/i915/gvt: Do not use I915_NUM_ENGINES to iterate over the mocs regs array
"Linux Kernel Mailing List" <[email protected]>
| Newsgroups | gmane.linux.kernel.commits.head |
|---|---|
| Message-ID | <[email protected]> |
Web: https://git.kernel.org/torvalds/c/8466169ab9fe9f0c3412881116aca895feea6e70 Commit: 8466169ab9fe9f0c3412881116aca895feea6e70 Parent: cc753fbe1ac47560e1517e3e11fb0c8a3c95eef5 Refname: refs/heads/master Author: Michel Thierry <[email protected]> AuthorDate: Mon Jan 8 10:37:34 2018 -0800 Committer: Rodrigo Vivi <[email protected]> CommitDate: Thu Feb 1 07:31:07 2018 -0800 drm/i915/gvt: Do not use I915_NUM_ENGINES to iterate over the mocs regs array The mocs reg array is defined locally but then we iterate over its elements using I915_NUM_ENGINES. There is no 'hard' connection between I915_NUM_ENGINES and the regs array and there will be problems if either of them increases. Use the size of the mocs reg array instead to safely iterate over it. Signed-off-by: Michel Thierry <[email protected]> Cc: Weinan Li <[email protected]> Cc: Zhenyu Wang <[email protected]> Signed-off-by: Zhenyu Wang <[email protected]> Signed-off-by: Rodrigo Vivi <[email protected]> --- drivers/gpu/drm/i915/gvt/mmio_context.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/gvt/mmio_context.c b/drivers/gpu/drm/i915/gvt/mmio_context.c index 48ee61ac9bc5..73ad6e90e49d 100644 --- a/drivers/gpu/drm/i915/gvt/mmio_context.c +++ b/drivers/gpu/drm/i915/gvt/mmio_context.c @@ -167,7 +167,7 @@ static void load_render_mocs(struct drm_i915_private *dev_priv) }; int ring_id, i; - for (ring_id = 0; ring_id < I915_NUM_ENGINES; ring_id++) { + for (ring_id = 0; ring_id < ARRAY_SIZE(regs); ring_id++) { offset.reg = regs[ring_id]; for (i = 0; i < 64; i++) { gen9_render_mocs.control_table[ring_id][i] = -- To unsubscribe from this list: send the line "unsubscribe git-commits-head" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html