SDL: Skip PS4/PS5 probe message if we already know it's a supported controller

From 899a1e7cbab8ed2b7500d18f52cce12369671621 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Thu, 22 Sep 2022 23:54:26 -0700
Subject: [PATCH] Skip PS4/PS5 probe message if we already know it's a
 supported controller

---
 src/joystick/hidapi/SDL_hidapi_ps4.c | 7 ++++++-
 src/joystick/hidapi/SDL_hidapi_ps5.c | 7 ++++++-
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/src/joystick/hidapi/SDL_hidapi_ps4.c b/src/joystick/hidapi/SDL_hidapi_ps4.c
index fcc4cca6b5a..216a37fa477 100644
--- a/src/joystick/hidapi/SDL_hidapi_ps4.c
+++ b/src/joystick/hidapi/SDL_hidapi_ps4.c
@@ -181,13 +181,18 @@ HIDAPI_DriverPS4_IsSupportedDevice(SDL_HIDAPI_Device *device, const char *name,
     Uint8 data[USB_PACKET_LENGTH];
     int size;
 
+    if (type == SDL_CONTROLLER_TYPE_PS4) {
+        return SDL_TRUE;
+    }
+
     if (device && SONY_THIRDPARTY_VENDOR(device->vendor_id) &&
         (size = ReadFeatureReport(device->dev, k_ePS4FeatureReportIdCapabilities, data, sizeof(data))) == 48 &&
         data[2] == 0x27) {
         /* Supported third party controller */
         return SDL_TRUE;
     }
-    return (type == SDL_CONTROLLER_TYPE_PS4) ? SDL_TRUE : SDL_FALSE;
+
+    return SDL_FALSE;
 }
 
 static void
diff --git a/src/joystick/hidapi/SDL_hidapi_ps5.c b/src/joystick/hidapi/SDL_hidapi_ps5.c
index e128eda16fa..187bfb2c40a 100644
--- a/src/joystick/hidapi/SDL_hidapi_ps5.c
+++ b/src/joystick/hidapi/SDL_hidapi_ps5.c
@@ -263,13 +263,18 @@ HIDAPI_DriverPS5_IsSupportedDevice(SDL_HIDAPI_Device *device, const char *name,
     Uint8 data[USB_PACKET_LENGTH];
     int size;
 
+    if (type == SDL_CONTROLLER_TYPE_PS5) {
+        return SDL_TRUE;
+    }
+
     if (device && SONY_THIRDPARTY_VENDOR(device->vendor_id) &&
         (size = ReadFeatureReport(device->dev, k_EPS5FeatureReportIdCapabilities, data, sizeof(data))) == 48 &&
         data[2] == 0x28) {
         /* Supported third party controller */
         return SDL_TRUE;
     }
-    return (type == SDL_CONTROLLER_TYPE_PS5) ? SDL_TRUE : SDL_FALSE;
+
+    return SDL_FALSE;
 }
 
 static void