From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@lists.01.org,
Anand Ashok Dumbre <anand.ashok.dumbre@xilinx.com>,
jic23@kernel.org, knaack.h@gmx.de, lars@metafoo.de,
pmeerw@pmeerw.net, michal.simek@xilinx.com, git@xilinx.com,
linux-iio@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Cc: lkp@intel.com, kbuild-all@lists.01.org, anandash@xilinx.com
Subject: Re: [PATCH v2] iio: core: Fix IIO_VAL_FRACTIONAL calculation for negative values
Date: Mon, 31 Aug 2020 12:51:52 +0300 [thread overview]
Message-ID: <20200831095152.GD8299@kadam> (raw)
In-Reply-To: <1598465676-28912-1-git-send-email-anand.ashok.dumbre@xilinx.com>
[-- Attachment #1: Type: text/plain, Size: 8070 bytes --]
Hi Anand,
url: https://github.com/0day-ci/linux/commits/Anand-Ashok-Dumbre/iio-core-Fix-IIO_VAL_FRACTIONAL-calculation-for-negative-values/20200827-021613
base: https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git togreg
config: x86_64-randconfig-m001-20200826 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
smatch warnings:
drivers/iio/industrialio-core.c:620 __iio_format_value() error: uninitialized symbol 'tmp'.
# https://github.com/0day-ci/linux/commit/c66f94e17db7eca581318d225d1fb41c56aced08
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Anand-Ashok-Dumbre/iio-core-Fix-IIO_VAL_FRACTIONAL-calculation-for-negative-values/20200827-021613
git checkout c66f94e17db7eca581318d225d1fb41c56aced08
vim +/tmp +620 drivers/iio/industrialio-core.c
51239600074bc9 drivers/iio/industrialio-core.c Jonathan Cameron 2016-11-08 590 static ssize_t __iio_format_value(char *buf, size_t len, unsigned int type,
51239600074bc9 drivers/iio/industrialio-core.c Jonathan Cameron 2016-11-08 591 int size, const int *vals)
1d892719e70e47 drivers/staging/iio/industrialio-core.c Jonathan Cameron 2011-05-18 592 {
7985e7c1003bc5 drivers/iio/industrialio-core.c Lars-Peter Clausen 2012-09-14 593 unsigned long long tmp;
51239600074bc9 drivers/iio/industrialio-core.c Jonathan Cameron 2016-11-08 594 int tmp0, tmp1;
c66f94e17db7ec drivers/iio/industrialio-core.c Anand Ashok Dumbre 2020-08-26 595 s64 tmp2;
67eedba39ed1ac drivers/iio/industrialio-core.c Michael Hennerich 2012-05-11 596 bool scale_db = false;
1d892719e70e47 drivers/staging/iio/industrialio-core.c Jonathan Cameron 2011-05-18 597
3661f3f5e961f7 drivers/iio/industrialio-core.c Lars-Peter Clausen 2013-10-07 598 switch (type) {
67eedba39ed1ac drivers/iio/industrialio-core.c Michael Hennerich 2012-05-11 599 case IIO_VAL_INT:
35a4eeb055c9c3 drivers/iio/industrialio-core.c Takashi Iwai 2020-03-11 600 return scnprintf(buf, len, "%d", vals[0]);
67eedba39ed1ac drivers/iio/industrialio-core.c Michael Hennerich 2012-05-11 601 case IIO_VAL_INT_PLUS_MICRO_DB:
67eedba39ed1ac drivers/iio/industrialio-core.c Michael Hennerich 2012-05-11 602 scale_db = true;
9d793c1a7f25d7 drivers/iio/industrialio-core.c Gustavo A. R. Silva 2017-11-08 603 /* fall through */
67eedba39ed1ac drivers/iio/industrialio-core.c Michael Hennerich 2012-05-11 604 case IIO_VAL_INT_PLUS_MICRO:
9fbfb4b37ed23f drivers/iio/industrialio-core.c Srinivas Pandruvada 2014-04-29 605 if (vals[1] < 0)
35a4eeb055c9c3 drivers/iio/industrialio-core.c Takashi Iwai 2020-03-11 606 return scnprintf(buf, len, "-%d.%06u%s", abs(vals[0]),
8f57e4d930d482 drivers/iio/industrialio-core.c Michal Nazarewicz 2016-01-15 607 -vals[1], scale_db ? " dB" : "");
1d892719e70e47 drivers/staging/iio/industrialio-core.c Jonathan Cameron 2011-05-18 608 else
35a4eeb055c9c3 drivers/iio/industrialio-core.c Takashi Iwai 2020-03-11 609 return scnprintf(buf, len, "%d.%06u%s", vals[0], vals[1],
67eedba39ed1ac drivers/iio/industrialio-core.c Michael Hennerich 2012-05-11 610 scale_db ? " dB" : "");
67eedba39ed1ac drivers/iio/industrialio-core.c Michael Hennerich 2012-05-11 611 case IIO_VAL_INT_PLUS_NANO:
9fbfb4b37ed23f drivers/iio/industrialio-core.c Srinivas Pandruvada 2014-04-29 612 if (vals[1] < 0)
35a4eeb055c9c3 drivers/iio/industrialio-core.c Takashi Iwai 2020-03-11 613 return scnprintf(buf, len, "-%d.%09u", abs(vals[0]),
9fbfb4b37ed23f drivers/iio/industrialio-core.c Srinivas Pandruvada 2014-04-29 614 -vals[1]);
71646e2c7ae4ed drivers/staging/iio/industrialio-core.c Michael Hennerich 2011-06-27 615 else
35a4eeb055c9c3 drivers/iio/industrialio-core.c Takashi Iwai 2020-03-11 616 return scnprintf(buf, len, "%d.%09u", vals[0], vals[1]);
7985e7c1003bc5 drivers/iio/industrialio-core.c Lars-Peter Clausen 2012-09-14 617 case IIO_VAL_FRACTIONAL:
c66f94e17db7ec drivers/iio/industrialio-core.c Anand Ashok Dumbre 2020-08-26 618 tmp2 = div_s64((s64)vals[0] * 1000000000LL, vals[1]);
51239600074bc9 drivers/iio/industrialio-core.c Jonathan Cameron 2016-11-08 619 tmp1 = vals[1];
51239600074bc9 drivers/iio/industrialio-core.c Jonathan Cameron 2016-11-08 @620 tmp0 = (int)div_s64_rem(tmp, 1000000000, &tmp1);
^^^
Probably "tmp2" was intended?
c66f94e17db7ec drivers/iio/industrialio-core.c Anand Ashok Dumbre 2020-08-26 621 if ((tmp2 < 0) && (tmp0 == 0))
c66f94e17db7ec drivers/iio/industrialio-core.c Anand Ashok Dumbre 2020-08-26 622 return snprintf(buf, len, "-0.%09u", abs(tmp1));
c66f94e17db7ec drivers/iio/industrialio-core.c Anand Ashok Dumbre 2020-08-26 623 else
c66f94e17db7ec drivers/iio/industrialio-core.c Anand Ashok Dumbre 2020-08-26 624 return snprintf(buf, len, "%d.%09u", tmp0, abs(tmp1));
103d9fb907058e drivers/iio/industrialio-core.c Lars-Peter Clausen 2012-10-16 625 case IIO_VAL_FRACTIONAL_LOG2:
7fd6592d128704 drivers/iio/industrialio-core.c Nikolaus Schulz 2017-03-24 626 tmp = shift_right((s64)vals[0] * 1000000000LL, vals[1]);
7fd6592d128704 drivers/iio/industrialio-core.c Nikolaus Schulz 2017-03-24 627 tmp0 = (int)div_s64_rem(tmp, 1000000000LL, &tmp1);
35a4eeb055c9c3 drivers/iio/industrialio-core.c Takashi Iwai 2020-03-11 628 return scnprintf(buf, len, "%d.%09u", tmp0, abs(tmp1));
9fbfb4b37ed23f drivers/iio/industrialio-core.c Srinivas Pandruvada 2014-04-29 629 case IIO_VAL_INT_MULTIPLE:
9fbfb4b37ed23f drivers/iio/industrialio-core.c Srinivas Pandruvada 2014-04-29 630 {
9fbfb4b37ed23f drivers/iio/industrialio-core.c Srinivas Pandruvada 2014-04-29 631 int i;
51239600074bc9 drivers/iio/industrialio-core.c Jonathan Cameron 2016-11-08 632 int l = 0;
9fbfb4b37ed23f drivers/iio/industrialio-core.c Srinivas Pandruvada 2014-04-29 633
51239600074bc9 drivers/iio/industrialio-core.c Jonathan Cameron 2016-11-08 634 for (i = 0; i < size; ++i) {
35a4eeb055c9c3 drivers/iio/industrialio-core.c Takashi Iwai 2020-03-11 635 l += scnprintf(&buf[l], len - l, "%d ", vals[i]);
51239600074bc9 drivers/iio/industrialio-core.c Jonathan Cameron 2016-11-08 636 if (l >= len)
51239600074bc9 drivers/iio/industrialio-core.c Jonathan Cameron 2016-11-08 637 break;
51239600074bc9 drivers/iio/industrialio-core.c Jonathan Cameron 2016-11-08 638 }
51239600074bc9 drivers/iio/industrialio-core.c Jonathan Cameron 2016-11-08 639 return l;
9fbfb4b37ed23f drivers/iio/industrialio-core.c Srinivas Pandruvada 2014-04-29 640 }
8cb3403633146a drivers/iio/industrialio-core.c Andrea Merello 2019-11-20 641 case IIO_VAL_CHAR:
35a4eeb055c9c3 drivers/iio/industrialio-core.c Takashi Iwai 2020-03-11 642 return scnprintf(buf, len, "%c", (char)vals[0]);
67eedba39ed1ac drivers/iio/industrialio-core.c Michael Hennerich 2012-05-11 643 default:
1d892719e70e47 drivers/staging/iio/industrialio-core.c Jonathan Cameron 2011-05-18 644 return 0;
1d892719e70e47 drivers/staging/iio/industrialio-core.c Jonathan Cameron 2011-05-18 645 }
67eedba39ed1ac drivers/iio/industrialio-core.c Michael Hennerich 2012-05-11 646 }
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 40677 bytes --]
prev parent reply other threads:[~2020-08-31 9:52 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-26 18:14 [PATCH v2] iio: core: Fix IIO_VAL_FRACTIONAL calculation for negative values Anand Ashok Dumbre
2020-08-29 15:19 ` Jonathan Cameron
2020-08-31 8:55 ` Anand Ashok Dumbre
2020-08-31 9:51 ` Dan Carpenter [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200831095152.GD8299@kadam \
--to=dan.carpenter@oracle.com \
--cc=anand.ashok.dumbre@xilinx.com \
--cc=anandash@xilinx.com \
--cc=git@xilinx.com \
--cc=jic23@kernel.org \
--cc=kbuild-all@lists.01.org \
--cc=kbuild@lists.01.org \
--cc=knaack.h@gmx.de \
--cc=lars@metafoo.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lkp@intel.com \
--cc=michal.simek@xilinx.com \
--cc=pmeerw@pmeerw.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).