struct vmw_legacy_display_unit *entry;
        struct drm_framebuffer *fb = NULL;
        struct drm_crtc *crtc = NULL;
-       int i = 0;
+       int i;
 
        /* If there is no display topology the host just assumes
         * that the guest will set the same layout as the host.
                        crtc = &entry->base.crtc;
                        w = max(w, crtc->x + crtc->mode.hdisplay);
                        h = max(h, crtc->y + crtc->mode.vdisplay);
-                       i++;
                }
 
                if (crtc == NULL)
                        return 0;
-               fb = entry->base.crtc.primary->state->fb;
+               fb = crtc->primary->state->fb;
 
                return vmw_kms_write_svga(dev_priv, w, h, fb->pitches[0],
                                          fb->format->cpp[0] * 8,