Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp1497582rdb; Mon, 2 Oct 2023 11:16:57 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHOaA+7SBHbyFI/cmyPG5YXrxioWUowc9WUnfneaXP1XqGU5ciutIGzD0ckyLi1d42WipkI X-Received: by 2002:a05:6a20:7da6:b0:15e:108c:35b0 with SMTP id v38-20020a056a207da600b0015e108c35b0mr12822047pzj.4.1696270616899; Mon, 02 Oct 2023 11:16:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696270616; cv=none; d=google.com; s=arc-20160816; b=t11IebSZpdmnxr8dOM2iIO91iNVxRSuxtYUliTgssb1LriLubBgjY03zfFn0cY/hea 9f+28cdxbtTwv/iwCDkTs2U5aJkmLZDMD1KfiAOqQ4YH9OGm6L7w80WncL4lxm3yuCMS pmALmVOTzH5AYd3TOtS1LNXfII7wCv8xZ+YrJEzXjBAcCjMH3bgppw0VzQ+bVXXy3hVy oa6uwj7V5lRwhBJ9w8zernqEXn/+skZfs+P/4pX082CZzgbZSUqJA+XRmlB5Cgc6yWa8 Ec/H9w0Pc/2QRn7pSLp6vosiLCEGf7EVa+KSFoRNU3i7wKyXua2KPbZ00rJS9wauBMNw Km1g== 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=C79CIhIy0nXoXIzrm7gnrZ24ZRyaYzQAxnTvfUvX5BU=; fh=OahkkZGRMsx/QsvTzHLvmCoK5Fz3HImW7eii1n0wrVw=; b=k5WCg4QhDn8S5bobN0mmgct3J7WVIc/cb6l9PCEsWwq1OUEBVm8eoUtYnWm7e9NXc3 IYSRR4o2DwwitNn4uirFBXPFbol6jMPS4N06kr2SMZiK23XIoUy5SJBFahPpKu1oN5WM caGm4jIsvxL6mNfBxhLAfavALdasVkicaevf2Px79LufvVHqUQOXKb2G8HH5nUBiCDiq QqTC0N5ZTttiTLWjMxhfDU00luo5s4xHig5GoQ2frMebdr+lITZny7mYowBO+S/7KdkQ rYSRzPDM2EmN1vA5hSxAukBCaCflf2qg2dMDVDX8K5MN50jgBk0JfElGpe1uYFOTrkm/ 3feQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b="lu8FI5Q/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id be15-20020a056a001f0f00b0069338b22c0csi13217338pfb.359.2023.10.02.11.16.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Oct 2023 11:16:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b="lu8FI5Q/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 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 agentk.vger.email (Postfix) with ESMTP id 0D36180BC52C; Mon, 2 Oct 2023 09:16:54 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238434AbjJBQQg (ORCPT + 99 others); Mon, 2 Oct 2023 12:16:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37816 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238488AbjJBQQc (ORCPT ); Mon, 2 Oct 2023 12:16:32 -0400 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C63889E; Mon, 2 Oct 2023 09:16:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1696263389; x=1727799389; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=DPrZPdYeRNfXZOtbRB8PnTVno3GzcqOBQS4+4QktUg4=; b=lu8FI5Q/DBu+DUAfA7dIG6R/munxfToM5VLF8zyz56uM6I/YVxSaGXSG s/dFBKkd4CxsjMputLBUnB+2DZHClgj/5zWvbYJtXLZ1hm5rj0vRz7w/q W28497nGRh4RMwpO2C6E5hBolRIDNVJY1WGAv2DtiN7TuPI1YH2IXWan9 jBle+S1ccjNcXa1sDfthA1KpWwZuXXbEVEKrX8kY6ftBZSBaUZoqBYNVx UAorNKaOyZPbJOUK1KUUjeJNq+PM+v3OLoHJXrkcsDiDUp7iOdF0K1AYg ljYlkw3CK7IxeVPRXXd4ZwdqdGs4/Nu/2n3Xsu4j7lo3gxnvk58QTEnMo Q==; X-CSE-ConnectionGUID: M5MHFYEZQ66VfybJvKr2SQ== X-CSE-MsgGUID: yuxl+01OQCaK38yX3xDJQg== X-ThreatScanner-Verdict: Negative X-IronPort-AV: E=Sophos;i="6.03,194,1694761200"; d="scan'208";a="7940525" X-Amp-Result: SKIPPED(no attachment in message) Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa1.microchip.iphmx.com with ESMTP/TLS/ECDHE-RSA-AES128-GCM-SHA256; 02 Oct 2023 09:16:29 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.21; Mon, 2 Oct 2023 09:16:28 -0700 Received: from marius-VM.mshome.net (10.10.85.11) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server id 15.1.2507.21 via Frontend Transport; Mon, 2 Oct 2023 09:16:27 -0700 From: To: , , , CC: , , Subject: [PATCH v1] iio: adc: MCP3564: fix warn: unsigned '__x' is never less than zero. Date: Mon, 2 Oct 2023 19:16:18 +0300 Message-ID: <20231002161618.36373-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 agentk.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 (agentk.vger.email [0.0.0.0]); Mon, 02 Oct 2023 09:16:54 -0700 (PDT) From: Marius Cristea The patch efea15e3c65d: "iio: adc: MCP3564: fix the static checker warning" 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: efea15e3c65d (iio: adc: MCP3564: fix the static checker warning) 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