[PATCH] char: mwave: smapi: Make usSmapiOK signed to fix warning

From: Purva Yeshi
Date: Wed Apr 09 2025 - 17:20:06 EST


Fix Smatch-detected warning:
drivers/char/mwave/smapi.c:69 smapi_request() warn:
assigning (-5) to unsigned variable 'usSmapiOK'

Assigning a negative value (-EIO, which is -5) to an unsigned short
(usSmapiOK) causes a Smatch warning because negative values cannot
be correctly represented in an unsigned type, leading to unexpected
behavior.

Change the type of usSmapiOK from unsigned short to short to allow
storing negative values like -EIO without causing a type mismatch or
logic error.

Signed-off-by: Purva Yeshi <purvayeshi550@xxxxxxxxx>
---
drivers/char/mwave/smapi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/char/mwave/smapi.c b/drivers/char/mwave/smapi.c
index f8d79d393b69..37da1339357e 100644
--- a/drivers/char/mwave/smapi.c
+++ b/drivers/char/mwave/smapi.c
@@ -66,7 +66,7 @@ static int smapi_request(unsigned short inBX, unsigned short inCX,
unsigned short myoutDX = 5, *pmyoutDX = &myoutDX;
unsigned short myoutDI = 6, *pmyoutDI = &myoutDI;
unsigned short myoutSI = 7, *pmyoutSI = &myoutSI;
- unsigned short usSmapiOK = -EIO, *pusSmapiOK = &usSmapiOK;
+ short usSmapiOK = -EIO, *pusSmapiOK = &usSmapiOK;
unsigned int inBXCX = (inBX << 16) | inCX;
unsigned int inDISI = (inDI << 16) | inSI;
int retval = 0;
--
2.34.1