SDL: Return the SDL_SetError value

From 6f0acca8bd9fb66fb521e11b5bbefd570fc8280b Mon Sep 17 00:00:00 2001
From: Sylvain <[EMAIL REDACTED]>
Date: Mon, 6 Feb 2023 11:41:01 +0100
Subject: [PATCH] Return the SDL_SetError value

---
 src/haptic/darwin/SDL_syshaptic.c | 6 ++----
 src/video/SDL_video.c             | 3 +--
 2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/src/haptic/darwin/SDL_syshaptic.c b/src/haptic/darwin/SDL_syshaptic.c
index 3b3bf3a6a3b6..f2b6fd825454 100644
--- a/src/haptic/darwin/SDL_syshaptic.c
+++ b/src/haptic/darwin/SDL_syshaptic.c
@@ -485,8 +485,7 @@ static int SDL_SYS_HapticOpenFromService(SDL_Haptic *haptic, io_service_t servic
     /* Open the device */
     ret = FFCreateDevice(service, &haptic->hwdata->device);
     if (ret != FF_OK) {
-        SDL_SetError("Haptic: Unable to create device from service: %s.",
-                     FFStrError(ret));
+        SDL_SetError("Haptic: Unable to create device from service: %s.", FFStrError(ret));
         goto creat_err;
     }
 
@@ -1260,9 +1259,8 @@ int SDL_SYS_HapticGetEffectStatus(SDL_Haptic *haptic,
 
     ret = FFEffectGetEffectStatus(effect->hweffect->ref, &status);
     if (ret != FF_OK) {
-        SDL_SetError("Haptic: Unable to get effect status: %s.",
+        return SDL_SetError("Haptic: Unable to get effect status: %s.",
                      FFStrError(ret));
-        return -1;
     }
 
     if (status == 0) {
diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c
index 4a8006acca62..7610c4121c2c 100644
--- a/src/video/SDL_video.c
+++ b/src/video/SDL_video.c
@@ -770,8 +770,7 @@ int SDL_GetDisplayIndex(SDL_DisplayID displayID)
             return display_index;
         }
     }
-    SDL_SetError("Invalid display");
-    return -1;
+    return SDL_SetError("Invalid display");
 }
 
 SDL_DisplayData *SDL_GetDisplayDriverData(SDL_DisplayID displayID)