From nobody Sat Jun 20 01:55:54 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 46750C433F5 for ; Thu, 24 Mar 2022 07:11:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348423AbiCXHNM (ORCPT ); Thu, 24 Mar 2022 03:13:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59160 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238062AbiCXHNI (ORCPT ); Thu, 24 Mar 2022 03:13:08 -0400 Received: from mail.meizu.com (edge07.meizu.com [112.91.151.210]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C6C68985A3 for ; Thu, 24 Mar 2022 00:11:36 -0700 (PDT) Received: from IT-EXMB-1-125.meizu.com (172.16.1.125) by mz-mail11.meizu.com (172.16.1.15) with Microsoft SMTP Server (TLS) id 14.3.487.0; Thu, 24 Mar 2022 15:11:27 +0800 Received: from meizu.meizu.com (172.16.137.70) by IT-EXMB-1-125.meizu.com (172.16.1.125) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.14; Thu, 24 Mar 2022 15:11:27 +0800 From: Haowen Bai To: , CC: , Haowen Bai Subject: [PATCH] char: mwave: Fix assigning negative error code to unsigned variable Date: Thu, 24 Mar 2022 15:11:26 +0800 Message-ID: <1648105886-9323-1-git-send-email-baihaowen@meizu.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 X-Originating-IP: [172.16.137.70] X-ClientProxiedBy: IT-EXMB-1-125.meizu.com (172.16.1.125) To IT-EXMB-1-125.meizu.com (172.16.1.125) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Fix the issue by changing the type of usSmapiOK to short, since the=20 negative error value is assigned to unsigned variables would be ignored. Signed-off-by: Haowen Bai --- 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 =3D 5, *pmyoutDX =3D &myoutDX; unsigned short myoutDI =3D 6, *pmyoutDI =3D &myoutDI; unsigned short myoutSI =3D 7, *pmyoutSI =3D &myoutSI; - unsigned short usSmapiOK =3D -EIO, *pusSmapiOK =3D &usSmapiOK; + unsigned short *pusSmapiOK =3D &usSmapiOK; unsigned int inBXCX =3D (inBX << 16) | inCX; unsigned int inDISI =3D (inDI << 16) | inSI; int retval =3D 0; + short usSmapiOK =3D -EIO; =20 PRINTK_5(TRACE_SMAPI, "inBX %x inCX %x inDI %x inSI %x\n", inBX, inCX, inDI, inSI); --=20 2.7.4