Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp957789rdg; Fri, 13 Oct 2023 06:24:29 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEeLMZvQiuIAoy2WoDX1EPQCdt88moGSxL+Ul/+FCgtGrxU2l1mXeQl3/2WEXy7QJFXfWNX X-Received: by 2002:a05:6a20:7f9a:b0:163:a041:336c with SMTP id d26-20020a056a207f9a00b00163a041336cmr31405310pzj.48.1697203469622; Fri, 13 Oct 2023 06:24:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697203469; cv=none; d=google.com; s=arc-20160816; b=kSGksBbtzvdC0J+s1XOV9HaHLHwHhma6FrQ6mTGJUoxuU8F3HnBe4E3LfOPS79VfkF pcS8J47SEGUB6O0wBg//ASuSFXlSwCUJDU79+RCLiPcXnvksCApH2vvzcpbLW56fkk5s 0bYa/Vj4ALZojupeYiDpNBm5qGz96X89hXyJBjH7dzzB1nhj9f8/n3clGi8xX7u5KF// WCUrZeNMO2Y6kIVcWYYGqwRNXRq7AFJ3GInaiRSEEfqI2hgAo0rIUCEh2nxbZMYX5KhK 66rwzSbs+bbQR397BlOlTKCseI+ycEOyWhyq17XP98jxBLfEaiWlinNaGx3xFKTUkHbD z/lA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=hhs5AWZMcdrJM0Lc+BUfhIDPEZlkGbtOhLNBsSXzLLU=; fh=OahkkZGRMsx/QsvTzHLvmCoK5Fz3HImW7eii1n0wrVw=; b=Bg2oNsg3WJTE08h2Geaoc1+vICggzRIxmmqOhRdKcorz0kUBjmoHv6OAevq4HP4fwJ 7DfhnDMPIjyjuBWi8s37wBUIghmCsuLQN8sIxXDQN0vvCdxWCtgYKR7qnPS55GizFdOK eFX5SsMUDWtVbXg4Ffx7M+qP6bhhwR4Vi8utDafC0Az8CRIQcUSF2nAGjuF5jG37F1xC JYPL6Y8vq1WGdExI3C4pW7VrOwVOIuUDMsFHyubAMievNd0Vm7pztqN6IJYlhP3ymU0W 7m/yVqBCjHENjsT/rk2XLj+NjGbmrpNGoLtmBNlUftW2KujsrjByzJIZ8it+PvPQop+q WUTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=bkVYaM7H; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Return-Path: Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id ob2-20020a17090b390200b0027d22503b9esi81492pjb.84.2023.10.13.06.24.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Oct 2023 06:24:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=bkVYaM7H; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 4237281EB46C; Fri, 13 Oct 2023 06:24:27 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231933AbjJMNYT (ORCPT + 99 others); Fri, 13 Oct 2023 09:24:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54210 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231939AbjJMNYS (ORCPT ); Fri, 13 Oct 2023 09:24:18 -0400 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4709EC0; Fri, 13 Oct 2023 06:24:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1697203456; x=1728739456; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=qbYnMk/PklOc0qHxIL6AsmTgq+JW0Tw9jXwiPLpTzqA=; b=bkVYaM7Hk5xiBe0akduqH+MgoNvab0JyZId8aBPhcMWTNMQagdPTdr4f /w64vHcEWj4h2br5d0luVLtSGjKtuqnAx0aZlkT750uBRC5+P41m1yz48 CT5fussSnBvCSYWPQuHUnT0sFQP0CqO79vUxOfosjP1KIHk1/qGWLIvBX rR4Rxt2Zs/b4QioIrhQJwEBFCouOhshrUuYzu7fTZOiHHWEf2v8fSoQSb 3BMTghQsI0PsAkjCX15s2y68dwbhkedkpRimb4AnhvpVDuJaiXhn/exbH NYuWK19lLASkb5acRu5Z8Uhl9d93yf1Rpi6MAauPU0ypAvURPqXiX773/ w==; X-CSE-ConnectionGUID: wo16nO66Q8+fbxSUIcLVMQ== X-CSE-MsgGUID: Rhe3GexBQSuFx8F9wttwvA== X-ThreatScanner-Verdict: Negative X-IronPort-AV: E=Sophos;i="6.03,222,1694761200"; d="scan'208";a="9931472" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa4.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 13 Oct 2023 06:24:15 -0700 Received: from chn-vm-ex04.mchp-main.com (10.10.85.152) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Fri, 13 Oct 2023 06:23:37 -0700 Received: from marius-VM.mshome.net (10.10.85.11) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server id 15.1.2507.21 via Frontend Transport; Fri, 13 Oct 2023 06:23:35 -0700 From: To: , , , CC: , , Subject: [PATCH v2] iio: adc: MCP3564: fix warn: unsigned '__x' is never less than zero. Date: Fri, 13 Oct 2023 16:23:33 +0300 Message-ID: <20231013132333.10582-1-marius.cristea@microchip.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Fri, 13 Oct 2023 06:24:27 -0700 (PDT) From: Marius Cristea The patch 33ec3e5fc1ea: "iio: adc: adding support for MCP3564 ADC" leads to the following Smatch static checker warning: smatch warnings: drivers/iio/adc/mcp3564.c:1105 mcp3564_fill_scale_tbls() warn: unsigned '__x' is never less than zero. vim +/__x +1105 drivers/iio/adc/mcp3564.c 1094 1095 static void mcp3564_fill_scale_tbls(struct mcp3564_state *adc) 1096 { ..... 1103 for (i = 0; i < MCP3564_MAX_PGA; i++) { 1104 ref = adc->vref_mv; > 1105 tmp1 = shift_right((u64)ref * NANO, pow); 1106 div_u64_rem(tmp1, NANO, &tmp0); 1107 ..... 1113 } Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-kbuild-all/202309280738.NWjVfVt4-lkp@intel.com/ Fixes: 33ec3e5fc1ea (iio: adc: adding support for MCP3564 ADC) Signed-off-by: Marius Cristea --- drivers/iio/adc/mcp3564.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/adc/mcp3564.c b/drivers/iio/adc/mcp3564.c index 9ede1a5d5d7b..e3f1de5fcc5a 100644 --- a/drivers/iio/adc/mcp3564.c +++ b/drivers/iio/adc/mcp3564.c @@ -1102,7 +1102,7 @@ static void mcp3564_fill_scale_tbls(struct mcp3564_state *adc) for (i = 0; i < MCP3564_MAX_PGA; i++) { ref = adc->vref_mv; - tmp1 = shift_right((u64)ref * NANO, pow); + tmp1 = ((u64)ref * NANO) >> pow; div_u64_rem(tmp1, NANO, &tmp0); tmp1 = tmp1 * mcp3564_hwgain_frac[(2 * i) + 1]; base-commit: 5e99f692d4e32e3250ab18d511894ca797407aec -- 2.34.1