[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20240706035314.153460-2-thorsten.blum@toblux.com>
Date: Sat, 6 Jul 2024 05:53:15 +0200
From: Thorsten Blum <thorsten.blum@...lux.com>
To: jikos@...nel.org,
bentiss@...nel.org
Cc: linux-input@...r.kernel.org,
linux-kernel@...r.kernel.org,
Thorsten Blum <thorsten.blum@...lux.com>
Subject: [PATCH] HID: hid-steam: Use clamp() macro
Use clamp() to actually clamp the value to the range [-32767, 32767]
(as mentioned in the function comment) instead of manually mapping
one specific value.
Compile-tested only.
Signed-off-by: Thorsten Blum <thorsten.blum@...lux.com>
---
drivers/hid/hid-steam.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/hid/hid-steam.c b/drivers/hid/hid-steam.c
index a765a48c0ab5..69dde025999b 100644
--- a/drivers/hid/hid-steam.c
+++ b/drivers/hid/hid-steam.c
@@ -1340,7 +1340,7 @@ static inline s16 steam_le16(u8 *data)
{
s16 x = (s16) le16_to_cpup((__le16 *)data);
- return x == -32768 ? -32767 : x;
+ return clamp(x, -32767, 32767);
}
/*
--
2.45.2
Powered by blists - more mailing lists