linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V2] char: mwave: Fix assigning negative error code to unsigned variable
@ 2022-03-24  7:29 Haowen Bai
  0 siblings, 0 replies; only message in thread
From: Haowen Bai @ 2022-03-24  7:29 UTC (permalink / raw)
  To: gregkh, arnd; +Cc: linux-kernel, Haowen Bai

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@meizu.com>
---
V1->V2: fix build error
 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..741a84d 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 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);
-- 
2.7.4


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2022-03-24  7:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-24  7:29 [PATCH V2] char: mwave: Fix assigning negative error code to unsigned variable Haowen Bai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).