Skip to contentSkip to conversation

char: mwave: Fix assigning negative error code to unsigned variable

PATCH New Haowen Bai 1 participant 1 message Mar 24, 2022 Char and misc drivers

lore
Share & tools
lore

Haowen Bai

author
#0 lore raw

PATCH v2 1/1 char: mwave: Fix assigning negative error code to unsigned variable

Fix the issue by changing the type of usSmapiOK to short, since the negative error value is assigned to unsigned variables would be ignored.

---
V1->V2: fix build error

 drivers/char/mwave/smapi.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/char/mwave/smapi.c +2 -1
index f8d79d3..741a84d 100644
@@ -66,10 +66,11 @@ 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;
 	unsigned int inBXCX = (inBX << 16) | inCX;
 	unsigned int inDISI = (inDI << 16) | inSI;
 	int retval = 0;
+	short usSmapiOK = -EIO;
+	unsigned short *pusSmapiOK = &usSmapiOK;
 
 	PRINTK_5(TRACE_SMAPI, "inBX %x inCX %x inDI %x inSI %x\n",
 		inBX, inCX, inDI, inSI);
Signature · 1 line
2.7.4