[<prev] [next>] [day] [month] [year] [list]
Message-ID: <1648105886-9323-1-git-send-email-baihaowen@meizu.com>
Date: Thu, 24 Mar 2022 15:11:26 +0800
From: Haowen Bai <baihaowen@...zu.com>
To: <gregkh@...uxfoundation.org>, <arnd@...db.de>
CC: <linux-kernel@...r.kernel.org>, Haowen Bai <baihaowen@...zu.com>
Subject: [PATCH] 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.
Signed-off-by: Haowen Bai <baihaowen@...zu.com>
---
drivers/char/mwave/smapi.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/char/mwave/smapi.c b/drivers/char/mwave/smapi.c
index f8d79d3..4a0123d 100644
--- a/drivers/char/mwave/smapi.c
+++ b/drivers/char/mwave/smapi.c
@@ -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 short *pusSmapiOK = &usSmapiOK;
unsigned int inBXCX = (inBX << 16) | inCX;
unsigned int inDISI = (inDI << 16) | inSI;
int retval = 0;
+ short usSmapiOK = -EIO;
PRINTK_5(TRACE_SMAPI, "inBX %x inCX %x inDI %x inSI %x\n",
inBX, inCX, inDI, inSI);
--
2.7.4
Powered by blists - more mailing lists