From patchwork Fri May 14 13:10:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 12257779 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, UNPARSEABLE_RELAY autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 44300C433B4 for ; Fri, 14 May 2021 13:10:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 141756145D for ; Fri, 14 May 2021 13:10:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229724AbhENNLo (ORCPT ); Fri, 14 May 2021 09:11:44 -0400 Received: from mx0a-00069f02.pphosted.com ([205.220.165.32]:16352 "EHLO mx0a-00069f02.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229469AbhENNLn (ORCPT ); Fri, 14 May 2021 09:11:43 -0400 Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 14ED2taC015440; Fri, 14 May 2021 13:10:17 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : mime-version : content-type; s=corp-2020-01-29; bh=BWZS0HN8ia2EZ8/iDhv4qJtHdLFxZrWdNxtzGbJVoN0=; b=ocYbePh5J/X9c1hpPR3BUDrT+QM2TqhQy9lZYKDxqBNKca/MxMVEFdBlg8Sh6PLUMvLe 8M+plEmYrliWXZM7T2rc2cuMEyjeewecvxE1Mqm8GCAderzdz+omUR5CV/qFBr76CxLP Qkt9CH+rCta59TQTymgER1T8se4U4GgpEQ6UKghmbqHoqx4whtR6GDBRe2ZuyfUH1Gb0 /MVeMvT1egGXDSZ+p9orNLesSDds4yScw87JNeZ/EQr2NbGF/P5D77XO/FuPYFezYPmm z6xTmGQE7LXiySXikKRqTDOhR3jlUFQVE/wZrI0htFHqi+X5HUVPLkstDSIUux6yWodx Gg== Received: from oracle.com (aserp3020.oracle.com [141.146.126.70]) by mx0b-00069f02.pphosted.com with ESMTP id 38gpqsrp8x-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 14 May 2021 13:10:17 +0000 Received: from aserp3020.oracle.com (aserp3020.oracle.com [127.0.0.1]) by pps.podrdrct (8.16.0.36/8.16.0.36) with SMTP id 14ED1DTI084169; Fri, 14 May 2021 13:10:16 GMT Received: from pps.reinject (localhost [127.0.0.1]) by aserp3020.oracle.com with ESMTP id 38gppe5jax-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 14 May 2021 13:10:16 +0000 Received: from aserp3020.oracle.com (aserp3020.oracle.com [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 14ED40Aa113198; Fri, 14 May 2021 13:10:15 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserp3020.oracle.com with ESMTP id 38gppe5j9a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 14 May 2021 13:10:15 +0000 Received: from abhmp0005.oracle.com (abhmp0005.oracle.com [141.146.116.11]) by aserv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 14EDAEuv018893; Fri, 14 May 2021 13:10:14 GMT Received: from mwanda (/102.36.221.92) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 14 May 2021 06:10:13 -0700 Date: Fri, 14 May 2021 16:10:07 +0300 From: Dan Carpenter To: Jonathan Cameron Cc: Lars-Peter Clausen , Joe Sandom , Andy Shevchenko , linux-iio@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH 1/2] iio: light: tsl2591: fix some signedness bugs Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-Mailer: git-send-email haha only kidding X-Proofpoint-GUID: Sb-hFiORgf1OQUOz4XMQTOELAE__bnP3 X-Proofpoint-ORIG-GUID: Sb-hFiORgf1OQUOz4XMQTOELAE__bnP3 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org These variables need to be int for the error handling to work. Fixes: f053d4e748ce ("iio: light: Added AMS tsl2591 driver implementation") Signed-off-by: Dan Carpenter --- drivers/iio/light/tsl2591.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/iio/light/tsl2591.c b/drivers/iio/light/tsl2591.c index 2bdae388ff01..26e3cb6c4ff8 100644 --- a/drivers/iio/light/tsl2591.c +++ b/drivers/iio/light/tsl2591.c @@ -213,7 +213,7 @@ static int tsl2591_gain_to_multiplier(const u8 als_gain) } } -static u8 tsl2591_multiplier_to_gain(const u32 multiplier) +static int tsl2591_multiplier_to_gain(const u32 multiplier) { switch (multiplier) { case TSL2591_CTRL_ALS_LOW_GAIN_MULTIPLIER: @@ -783,8 +783,8 @@ static int tsl2591_write_raw(struct iio_dev *indio_dev, int val, int val2, long mask) { struct tsl2591_chip *chip = iio_priv(indio_dev); - u32 int_time; - u8 gain; + int int_time; + int gain; int ret; mutex_lock(&chip->als_mutex);