Commit 6b81cac4202c5ca0eb93b9d2a17fe24eb5aa02aa

Ozkan Sezer 2020-12-19T01:25:50

remove duplicated SDL_SetError after calling check_atomic_modesetting()

diff --git a/src/video/kmsdrm/SDL_kmsdrmvideo.c b/src/video/kmsdrm/SDL_kmsdrmvideo.c
index 74d138b..b097372 100644
--- a/src/video/kmsdrm/SDL_kmsdrmvideo.c
+++ b/src/video/kmsdrm/SDL_kmsdrmvideo.c
@@ -391,17 +391,16 @@ void print_plane_info(_THIS, drmModePlanePtr plane)
     drmModeRes *resources;
     uint32_t type = 0;
     SDL_VideoData *viddata = ((SDL_VideoData *)_this->driverdata);
+    int i;
 
     drmModeObjectPropertiesPtr props = KMSDRM_drmModeObjectGetProperties(viddata->drm_fd,
         plane->plane_id, DRM_MODE_OBJECT_PLANE);
 
     /* Search the plane props for the plane type. */
-    for (int j = 0; j < props->count_props; j++) {
-
-        drmModePropertyPtr p = KMSDRM_drmModeGetProperty(viddata->drm_fd, props->props[j]);
-
+    for (i = 0; i < props->count_props; i++) {
+        drmModePropertyPtr p = KMSDRM_drmModeGetProperty(viddata->drm_fd, props->props[i]);
         if ((strcmp(p->name, "type") == 0)) {
-            type = props->prop_values[j];
+            type = props->prop_values[i];
         }
 
         KMSDRM_drmModeFreeProperty(p);
@@ -432,7 +431,7 @@ void print_plane_info(_THIS, drmModePlanePtr plane)
         return;
 
     printf("--PLANE ID: %d\nPLANE TYPE: %s\nCRTC READING THIS PLANE: %d\nCRTCS SUPPORTED BY THIS PLANE: ",  plane->plane_id, plane_type, plane->crtc_id);
-    for (int i = 0; i < resources->count_crtcs; i++) {
+    for (i = 0; i < resources->count_crtcs; i++) {
         if (plane->possible_crtcs & (1 << i)) {
             uint32_t crtc_id = resources->crtcs[i];
             printf ("%d", crtc_id);
@@ -1031,7 +1030,6 @@ int KMSDRM_DisplayDataInit (_THIS, SDL_DisplayData *dispdata) {
     /* Try ATOMIC compatibility */
     ret = check_atomic_modesetting(viddata->drm_fd);
     if (ret) {
-        ret = SDL_SetError("not compatible with atomic modesetting");
         goto cleanup;
     }
 
diff --git a/src/video/kmsdrm/SDL_kmsdrmvulkan.c b/src/video/kmsdrm/SDL_kmsdrmvulkan.c
index 49d4cf7..3b52951 100644
--- a/src/video/kmsdrm/SDL_kmsdrmvulkan.c
+++ b/src/video/kmsdrm/SDL_kmsdrmvulkan.c
@@ -202,6 +202,7 @@ SDL_bool KMSDRM_Vulkan_CreateSurface(_THIS,
 
     VkResult result;
     SDL_bool ret = SDL_FALSE;
+    int i;
 
     /* Get the function pointers for the functions we will use. */
     PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr =
@@ -326,14 +327,14 @@ SDL_bool KMSDRM_Vulkan_CreateSurface(_THIS,
        because videomode determines how big the scanout region is and we can't
        scanout a region bigger than the window (we would be reading past the
        buffer, and Vulkan would give us a confusing VK_ERROR_SURFACE_LOST_KHR). */
-    for (int i = 0; i < mode_count; i++) {
+    for (i = 0; i < mode_count; i++) {
         if (modes_props[i].parameters.visibleRegion.width <= window->w &&
             modes_props[i].parameters.visibleRegion.height <= window->h)
         {
             display_mode_props = modes_props[i];
             break;
         }
-    } 
+    }
 
     if (display_mode_props.parameters.visibleRegion.width == 0
         || display_mode_props.parameters.visibleRegion.height == 0)