From 78574a66b5b286e26839877640592980de089d64 Mon Sep 17 00:00:00 2001 From: Daniel Stone Date: Thu, 5 Apr 2018 14:58:40 +0100 Subject: [PATCH] modesetting: Don't reuse iterator in nested loop MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit drmmode_crtc_set_mode has a loop nested inside another loop, where both of them were using 'i' as the loop iterator. Rename it to avoid an infinite loop. Signed-off-by: Daniel Stone Reported-by: Michel Dänzer Reviewed-and-Tested-by: Michel Dänzer Reviewed-by: Adam Jackson --- hw/xfree86/drivers/modesetting/drmmode_display.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hw/xfree86/drivers/modesetting/drmmode_display.c b/hw/xfree86/drivers/modesetting/drmmode_display.c index 2b04c3555..cdcd4f3f3 100644 --- a/hw/xfree86/drivers/modesetting/drmmode_display.c +++ b/hw/xfree86/drivers/modesetting/drmmode_display.c @@ -777,12 +777,13 @@ drmmode_crtc_set_mode(xf86CrtcPtr crtc, Bool test_only) drmmode_crtc_private_ptr other_drmmode_crtc = other_crtc->driver_private; int lost_outputs = 0; int remaining_outputs = 0; + int j; if (other_crtc == crtc) continue; - for (i = 0; i < xf86_config->num_output; i++) { - xf86OutputPtr output = xf86_config->output[i]; + for (j = 0; j < xf86_config->num_output; j++) { + xf86OutputPtr output = xf86_config->output[j]; drmmode_output_private_ptr drmmode_output = output->driver_private; if (drmmode_output->current_crtc == other_crtc) {