From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-lf1-f46.google.com (mail-lf1-f46.google.com [209.85.167.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 35F1F66E8 for ; Thu, 22 Sep 2022 15:35:25 +0000 (UTC) Received: by mail-lf1-f46.google.com with SMTP id f14so15340342lfg.5 for ; Thu, 22 Sep 2022 08:35:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date; bh=akYYafNOuWhsG6Uk19XZx6qfSJseAlSpwqtkBF7c3Uk=; b=bG3jqbJBSs+Zy4pehkaom0r8y9QQG+SPrzfgyNRzJZ3MifqY3GiProheY0ofCXGVDD V+9lr2CClDAB514409u9Pcc/cIcKH0lYkRqOduh8UVS35q2YWeVSfkxyQNdh3VgsvlZr CCyyUReVJ7ZsX09wYGgKdoEQylvEAhHry/ZXPZiMTf/b9cT+XHFNzTOOLvRZ+vrDEbpL rSAkvBwmZUuRyhmNJWZiamDEHaJrs6fMAnlA+GYzOCpI808YvoV2ONoWwMuzNs1RUQhK ZwCWi9Su5Wqr7AbWDYlYJ3rQIehGw4GRZ6r6oFAe9ox5Pl7crlXRmT6s7bq0HoYLERL9 Sz2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date; bh=akYYafNOuWhsG6Uk19XZx6qfSJseAlSpwqtkBF7c3Uk=; b=CCTCLA7+D5pnghoo32KzgZi0ylsjVEEZyFssKz8xXsr/Gc1x61Ep9Y2vbjclEZ9PRs FtsnC1rpp0+OvMA9z7sxVXhuWfZFPx+/tgiS3E+yhWlq9SDos6SpTyLsgCzrDd7X+A4d l5+cLKyct+bIBnKKyPk/4uIvnI8mCUgxD0tZQnBTNsRe8Sxsg12zd9gY8Y4cxmowd/V5 FtmMYv22+swzXGdBoev6MNGTTv/NFIP61NjsDjED7wyJqNNYh0/UAemZurKjrayZZ54r SZL5fcEjZ6OoPohWWWDdzvk9LzX8VCPipc3EwYUg13Hh3ieJH5JA6mRsRuzSeMRfU4s2 uKGQ== X-Gm-Message-State: ACrzQf1AGB+1yCSDM5jHDQBrZFAHiJeWJc9nqHYGEojHYNlnUL5yJiG7 kVwdqOIE0JgCKKS6c708Xd0= X-Google-Smtp-Source: AMsMyM6Dqp3iJt9pKiV6yPIHyzWEcsdL4uMylG+LucaV60NBjxt5mrJnMR5fuAFkSMaaJyjZI+jFKQ== X-Received: by 2002:a05:6512:1055:b0:49a:de51:5458 with SMTP id c21-20020a056512105500b0049ade515458mr1420898lfb.585.1663860921607; Thu, 22 Sep 2022 08:35:21 -0700 (PDT) Received: from gmail.com (82-209-154-112.cust.bredband2.com. [82.209.154.112]) by smtp.gmail.com with ESMTPSA id p2-20020a19f002000000b004886508ca5csm992969lfc.68.2022.09.22.08.35.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Sep 2022 08:35:19 -0700 (PDT) Date: Thu, 22 Sep 2022 17:41:25 +0200 From: Marcus Folkesson To: Jonathan Cameron Cc: kernel test robot , llvm@lists.linux.dev, kbuild-all@lists.01.org, linux-kernel@vger.kernel.org, Andy Shevchenko Subject: Re: [jic23-iio:testing 58/58] drivers/iio/adc/mcp3911.c:274:6: warning: variable 'tmp0' set but not used Message-ID: References: <202209220845.GmS9zryR-lkp@intel.com> <20220922115925.00004ec9@huawei.com> Precedence: bulk X-Mailing-List: llvm@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="rIiIuRTFM5K9HQs3" Content-Disposition: inline In-Reply-To: <20220922115925.00004ec9@huawei.com> --rIiIuRTFM5K9HQs3 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Sep 22, 2022 at 11:59:25AM +0100, Jonathan Cameron wrote: > On Thu, 22 Sep 2022 08:50:17 +0800 > kernel test robot wrote: >=20 > > tree: https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git t= esting > > head: d4e1a549566b9ea8b96e80f0cdcbe99714ac256e > > commit: d4e1a549566b9ea8b96e80f0cdcbe99714ac256e [58/58] iio: adc: mcp3= 911: add support to set PGA > > config: x86_64-randconfig-a012 > > compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f2= 8c006a5895fc0e329fe15fead81e37457cb1d1) > > reproduce (this is a W=3D1 build): > > wget https://raw.githubusercontent.com/intel/lkp-tests/master/s= bin/make.cross -O ~/bin/make.cross > > chmod +x ~/bin/make.cross > > # https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git= /commit/?id=3Dd4e1a549566b9ea8b96e80f0cdcbe99714ac256e > > git remote add jic23-iio https://git.kernel.org/pub/scm/linux/k= ernel/git/jic23/iio.git > > git fetch --no-tags jic23-iio testing > > git checkout d4e1a549566b9ea8b96e80f0cdcbe99714ac256e > > # save the config file > > mkdir build_dir && cp config build_dir/.config > > COMPILER_INSTALL_PATH=3D$HOME/0day COMPILER=3Dclang make.cross = W=3D1 O=3Dbuild_dir ARCH=3Dx86_64 SHELL=3D/bin/bash drivers/iio/adc/ > >=20 > > If you fix the issue, kindly add following tag where applicable > > | Reported-by: kernel test robot > >=20 > > All warnings (new ones prefixed by >>): > >=20 > > >> drivers/iio/adc/mcp3911.c:274:6: warning: variable 'tmp0' set but no= t used [-Wunused-but-set-variable] =20 > > int tmp0, tmp1; > > ^ > > 1 warning generated. > >=20 > >=20 > > vim +/tmp0 +274 drivers/iio/adc/mcp3911.c > >=20 > > 268=09 > > 269 static int mcp3911_calc_scale_table(struct mcp3911 *adc) > > 270 { > > 271 u32 ref =3D MCP3911_INT_VREF_MV; > > 272 u32 div; > > 273 int ret; > > > 274 int tmp0, tmp1; =20 > > 275 s64 tmp2; > > 276=09 > > 277 if (adc->vref) { > > 278 ret =3D regulator_get_voltage(adc->vref); > > 279 if (ret < 0) { > > 280 dev_err(&adc->spi->dev, > > 281 "failed to get vref voltage: %d\n", > > 282 ret); > > 283 return ret; > > 284 } > > 285=09 > > 286 ref =3D ret / 1000; > > 287 } > > 288=09 > > 289 /* > > 290 * For 24-bit Conversion > > 291 * Raw =3D ((Voltage)/(Vref) * 2^23 * Gain * 1.5 > > 292 * Voltage =3D Raw * (Vref)/(2^23 * Gain * 1.5) > > 293 * > > 294 * ref =3D Reference voltage > > 295 * div =3D (2^23 * 1.5 * gain) =3D 12582912 * gain > > 296 */ > > 297 for (int i =3D 0; i < MCP3911_NUM_SCALES; i++) { > > 298 div =3D 12582912 * BIT(i); > > 299 tmp2 =3D div_s64((s64)ref * 1000000000LL, div); > > 300 tmp1 =3D div; > > 301 tmp0 =3D (int)div_s64_rem(tmp2, 1000000000, &tmp1); >=20 > Marcus,=20 > I'm guessing the intent here is just to get the remainder. =20 > Hence fix is probably just to drop tmp0? >=20 > If you confirm that I'll tweak the commit to do that. >=20 > Jonathan Hum, Yes. I actually think we can drop div, tmp0, tmp1 and tmp2. I think they are remnats for when I did the calculation differently. Do you want me to update the patchset? static int mcp3911_calc_scale_table(struct mcp3911 *adc) { u32 ref =3D MCP3911_INT_VREF_MV; - u32 div; int ret; - int tmp0, tmp1; - s64 tmp2; =2E... for (int i =3D 0; i < MCP3911_NUM_SCALES; i++) { - div =3D 12582912 * BIT(i); - tmp2 =3D div_s64((s64)ref * 1000000000LL, div); - tmp1 =3D div; - tmp0 =3D (int)div_s64_rem(tmp2, 1000000000, &tmp1); - mcp3911_scale_table[i][0] =3D 0; - mcp3911_scale_table[i][1] =3D tmp1; + mcp3911_scale_table[i][1] =3D 12582912 * BIT(i); } /Marcus >=20 >=20 > > 302=09 > > 303 mcp3911_scale_table[i][0] =3D 0; > > 304 mcp3911_scale_table[i][1] =3D tmp1; > > 305 } > > 306=09 > > 307 return 0; > > 308 } > > 309=09 > >=20 >=20 --rIiIuRTFM5K9HQs3 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEBVGi6LZstU1kwSxliIBOb1ldUjIFAmMsgiAACgkQiIBOb1ld UjLtjQ//TcKaFqSzCHllxcmrVvwl0n2nhcJ9M3R8iU+6B0EMRxYltiay5y4sSEZ8 ZPBI73jV+I3G0+X7/NoYARBEUpKSx4v1CvZTbaCswnMkWx3KX+9qaZChdHUdRl0t EGsi+SZVfi37GkqLeC+QdsWoctbQHsS9YdGor1k3foCEGfE29ShzKmn5PoQfOqjy FPwsU6HnIvP//jmRpKkbkaE9L0YE9C8pF1n/u0nDu5I3k+xCN+ka1lqG2+7fusuX 78IWuEH9g2684JyaMt7AO/yDPhrMPRO6IGS2PxNYiWB9qhKFmBs3vUgEMZeGaz3O /84ljkfsqOtem1FTiguei2J7w/PzT+NpYETFG/t8PGpgVulTPkfusldE4KdbMViC mroKe+qQRYLtF+WLTeva8FHUk7rUmA6AWyD4O1q6Lf/nwe/DMfbevPXTByiiEeep 8RvHZuiPjqgs20iL2a+N1bE2ZpgsTK4s6/wLIFWjGEgKEHCpzvploGYcxlBejeGJ 41FcJICerUxOI4BToaOVnErhGV/dSeEg3kGH7It6geglE1eokvZo91c1nHbCwoEI kIy34emeKF4PRyDVGVKk7NzrX0C1XZOiwc+n8VwdvOtneqVQyU4KrqiHKZ7sS7+q 5Kph9GfjZ71Xaa9yHHHgR7OF63PEmridtCswv+JTWhjSV7Hg9s0= =xQ2z -----END PGP SIGNATURE----- --rIiIuRTFM5K9HQs3-- From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: multipart/mixed; boundary="===============6385429682153767789==" MIME-Version: 1.0 From: Marcus Folkesson To: kbuild-all@lists.01.org Subject: Re: [jic23-iio:testing 58/58] drivers/iio/adc/mcp3911.c:274:6: warning: variable 'tmp0' set but not used Date: Thu, 22 Sep 2022 17:41:25 +0200 Message-ID: In-Reply-To: <20220922115925.00004ec9@huawei.com> List-Id: --===============6385429682153767789== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable On Thu, Sep 22, 2022 at 11:59:25AM +0100, Jonathan Cameron wrote: > On Thu, 22 Sep 2022 08:50:17 +0800 > kernel test robot wrote: > = > > tree: https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git t= esting > > head: d4e1a549566b9ea8b96e80f0cdcbe99714ac256e > > commit: d4e1a549566b9ea8b96e80f0cdcbe99714ac256e [58/58] iio: adc: mcp3= 911: add support to set PGA > > config: x86_64-randconfig-a012 > > compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f2= 8c006a5895fc0e329fe15fead81e37457cb1d1) > > reproduce (this is a W=3D1 build): > > wget https://raw.githubusercontent.com/intel/lkp-tests/master/s= bin/make.cross -O ~/bin/make.cross > > chmod +x ~/bin/make.cross > > # https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git= /commit/?id=3Dd4e1a549566b9ea8b96e80f0cdcbe99714ac256e > > git remote add jic23-iio https://git.kernel.org/pub/scm/linux/k= ernel/git/jic23/iio.git > > git fetch --no-tags jic23-iio testing > > git checkout d4e1a549566b9ea8b96e80f0cdcbe99714ac256e > > # save the config file > > mkdir build_dir && cp config build_dir/.config > > COMPILER_INSTALL_PATH=3D$HOME/0day COMPILER=3Dclang make.cross = W=3D1 O=3Dbuild_dir ARCH=3Dx86_64 SHELL=3D/bin/bash drivers/iio/adc/ > > = > > If you fix the issue, kindly add following tag where applicable > > | Reported-by: kernel test robot > > = > > All warnings (new ones prefixed by >>): > > = > > >> drivers/iio/adc/mcp3911.c:274:6: warning: variable 'tmp0' set but no= t used [-Wunused-but-set-variable] = > > int tmp0, tmp1; > > ^ > > 1 warning generated. > > = > > = > > vim +/tmp0 +274 drivers/iio/adc/mcp3911.c > > = > > 268 = > > 269 static int mcp3911_calc_scale_table(struct mcp3911 *adc) > > 270 { > > 271 u32 ref =3D MCP3911_INT_VREF_MV; > > 272 u32 div; > > 273 int ret; > > > 274 int tmp0, tmp1; = > > 275 s64 tmp2; > > 276 = > > 277 if (adc->vref) { > > 278 ret =3D regulator_get_voltage(adc->vref); > > 279 if (ret < 0) { > > 280 dev_err(&adc->spi->dev, > > 281 "failed to get vref voltage: %d\n", > > 282 ret); > > 283 return ret; > > 284 } > > 285 = > > 286 ref =3D ret / 1000; > > 287 } > > 288 = > > 289 /* > > 290 * For 24-bit Conversion > > 291 * Raw =3D ((Voltage)/(Vref) * 2^23 * Gain * 1.5 > > 292 * Voltage =3D Raw * (Vref)/(2^23 * Gain * 1.5) > > 293 * > > 294 * ref =3D Reference voltage > > 295 * div =3D (2^23 * 1.5 * gain) =3D 12582912 * gain > > 296 */ > > 297 for (int i =3D 0; i < MCP3911_NUM_SCALES; i++) { > > 298 div =3D 12582912 * BIT(i); > > 299 tmp2 =3D div_s64((s64)ref * 1000000000LL, div); > > 300 tmp1 =3D div; > > 301 tmp0 =3D (int)div_s64_rem(tmp2, 1000000000, &tmp1); > = > Marcus, = > I'm guessing the intent here is just to get the remainder. = > Hence fix is probably just to drop tmp0? > = > If you confirm that I'll tweak the commit to do that. > = > Jonathan Hum, Yes. I actually think we can drop div, tmp0, tmp1 and tmp2. I think they are remnats for when I did the calculation differently. Do you want me to update the patchset? static int mcp3911_calc_scale_table(struct mcp3911 *adc) { u32 ref =3D MCP3911_INT_VREF_MV; - u32 div; int ret; - int tmp0, tmp1; - s64 tmp2; .... for (int i =3D 0; i < MCP3911_NUM_SCALES; i++) { - div =3D 12582912 * BIT(i); - tmp2 =3D div_s64((s64)ref * 1000000000LL, div); - tmp1 =3D div; - tmp0 =3D (int)div_s64_rem(tmp2, 1000000000, &tmp1); - mcp3911_scale_table[i][0] =3D 0; - mcp3911_scale_table[i][1] =3D tmp1; + mcp3911_scale_table[i][1] =3D 12582912 * BIT(i); } /Marcus > = > = > > 302 = > > 303 mcp3911_scale_table[i][0] =3D 0; > > 304 mcp3911_scale_table[i][1] =3D tmp1; > > 305 } > > 306 = > > 307 return 0; > > 308 } > > 309 = > > = >=20 --===============6385429682153767789== Content-Type: application/pgp-signature MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="signature.asc" LS0tLS1CRUdJTiBQR1AgU0lHTkFUVVJFLS0tLS0KCmlRSXpCQUVCQ0FBZEZpRUVCVkdpNkxac3RV MWt3U3hsaUlCT2IxbGRVaklGQW1Nc2dpQUFDZ2tRaUlCT2IxbGQKVWpMdGpRLy9UY0thRnFTekNI bGx4Y21yVnZ3bDBuMm5oY0o5TTNSOGlVKzZCMEVNUnhZbHRpYXk1eTRzU0VaOApaUEJJNzNqVitJ M0cwK1g3L05vWUFSQkVVcEtTeDR2MUN2WlRiYUNzd25Na1d4M0tYKzlxYVpDaGRIVWRSbDB0CkVH c2krU1pWZmkzN0drcUxlQytRZHNXb2N0YlFIc1M5WWRHb3IxazNmb0NFR2ZFMjlTaHpLbW41UG9R Zk9xankKRlB3c1U2SG5JdlAvL2ptUnBLa2JrYUU5TDBZRTlDOHBGMW4vdTBuRHU1STNrK3hDTitr YTFscUcyKzdmdXN1WAo3OElXdUVIOWcyNjg0SnlhTXQ3QU8veURQaHJNUFJPNklHUzJQeE5ZaVdC OXFoS0ZtQnMzdlVnRU1aZUdhejNPCi84NGxqa2ZzcU90ZW0xRlRpZ3VlaTJKN3cvUHpUK05wWUVU RkcvdDhQR3BnVnVsVFBrZnVzbGRFNEtkYk1WaUMKbXJvS2UrcVFSWUx0RitXTFRldmE4RkhVazdy VW1BNkFXeUQ0TzFxNkxmL253ZS9ETWZiZXZQWFRCeWlpRWVlcAo4UnZIWnVpUGpxZ3MyMGlMMmEr TjFiRTJacGdzVEs0czYvd0xJRldqR0VnS0VIQ3B6dnBsb0dZY3hsQmVqZUdKCjQxRmNKSUNlclV4 T0k0QlRvYU9WbkVyaEdWL2RTZUVnM2tHSDdJdDZnZWdsRTFlb2t2Wm85MWMxbkhiQ3dvRUkKa0l5 MzRlbWVLRjRQUnlEVkdWS2s3TnpyWDBDMVhaT2l3YytuOFZ3ZHZPdG5lcVZReVU0S3JxaUhLWjdz UzcrcQo1S3BoOUdmalo3MVhhYTl5SEhIZ1I3T0Y2M1BFbXJpZHRDc3d2K0pUV2hqU1Y3SGc5czA9 Cj14UTJ6Ci0tLS0tRU5EIFBHUCBTSUdOQVRVUkUtLS0tLQo= --===============6385429682153767789==--