Commit 1d7966df150eac7e5bfc98c84d5ce0327f33dccc

Sylvain 2022-11-16T21:27:16

Remove un-needed check for NULL pointer. They were previously checked just before.

diff --git a/src/core/linux/SDL_ibus.c b/src/core/linux/SDL_ibus.c
index 8b74f57..b4fe231 100644
--- a/src/core/linux/SDL_ibus.c
+++ b/src/core/linux/SDL_ibus.c
@@ -549,10 +549,8 @@ SDL_IBus_Init(void)
         inotify_wd = inotify_add_watch(inotify_fd, addr_file, IN_CREATE | IN_MODIFY);
         SDL_free(addr_file);
         
-        if (addr) {
-            result = IBus_SetupConnection(dbus, addr);
-            SDL_free(addr);
-        }
+        result = IBus_SetupConnection(dbus, addr);
+        SDL_free(addr);
     }
     
     return result;
diff --git a/src/power/linux/SDL_syspower.c b/src/power/linux/SDL_syspower.c
index f4e1ecc..c33ab5c 100644
--- a/src/power/linux/SDL_syspower.c
+++ b/src/power/linux/SDL_syspower.c
@@ -648,9 +648,7 @@ SDL_GetPowerInfo_Linux_org_freedesktop_upower(SDL_PowerState *state, int *second
         check_upower_device(dbus->system_conn, paths[i], state, seconds, percent);
     }
 
-    if (dbus) {
-        dbus->free_string_array(paths);
-    }
+    dbus->free_string_array(paths);
 #endif  /* SDL_USE_LIBDBUS */
 
     return retval;
diff --git a/src/render/SDL_render.c b/src/render/SDL_render.c
index 722147c..5f821b3 100644
--- a/src/render/SDL_render.c
+++ b/src/render/SDL_render.c
@@ -1078,7 +1078,7 @@ SDL_CreateRenderer(SDL_Window * window, int index, Uint32 flags)
     /* new textures start at zero, so we start at 1 so first render doesn't flush by accident. */
     renderer->render_command_generation = 1;
 
-    if (window && renderer->GetOutputSize) {
+    if (renderer->GetOutputSize) {
         int window_w, window_h;
         int output_w, output_h;
         if (renderer->GetOutputSize(renderer, &output_w, &output_h) == 0) {
diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c
index 1ac9165..45965e3 100644
--- a/src/video/SDL_video.c
+++ b/src/video/SDL_video.c
@@ -1302,9 +1302,8 @@ SDL_GetWindowDisplayMode(SDL_Window * window, SDL_DisplayMode * mode)
         return SDL_SetError("Couldn't find display mode match");
     }
 
-    if (mode) {
-        *mode = fullscreen_mode;
-    }
+    *mode = fullscreen_mode;
+
     return 0;
 }
 
diff --git a/src/video/kmsdrm/SDL_kmsdrmvideo.c b/src/video/kmsdrm/SDL_kmsdrmvideo.c
index 4293e46..eae7214 100644
--- a/src/video/kmsdrm/SDL_kmsdrmvideo.c
+++ b/src/video/kmsdrm/SDL_kmsdrmvideo.c
@@ -308,8 +308,8 @@ KMSDRM_CreateDevice(void)
     return device;
 
 cleanup:
-    if (device)
-        SDL_free(device);
+    SDL_free(device);
+
     if (viddata)
         SDL_free(viddata);
     return NULL;