All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: kernel test robot <lkp@intel.com>
Cc: Tomasz Duszynski <tomasz.duszynski@octakon.com>,
	linux-iio@vger.kernel.org, kbuild-all@lists.01.org,
	linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
	robh+dt@kernel.org, andy.shevchenko@gmail.com, pmeerw@pmeerw.net
Subject: Re: [PATCH v5 1/4] iio: chemical: scd30: add core driver
Date: Sun, 14 Jun 2020 14:15:46 +0100	[thread overview]
Message-ID: <20200614141546.7a1af2f5@archlinux> (raw)
In-Reply-To: <202006090426.ENCJHJ1n%lkp@intel.com>

On Tue, 9 Jun 2020 04:18:56 +0800
kernel test robot <lkp@intel.com> wrote:

> Hi Tomasz,
> 
> I love your patch! Perhaps something to improve:
> 
> [auto build test WARNING on iio/togreg]
> [also build test WARNING on robh/for-next linux/master v5.7]
> [if your patch is applied to the wrong git tree, please drop us a note to help
> improve the system. BTW, we also suggest to use '--base' option to specify the
> base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
> 
> url:    https://github.com/0day-ci/linux/commits/Tomasz-Duszynski/Add-support-for-SCD30-sensor/20200608-020304
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git togreg
> compiler: gcc-9 (Debian 9.3.0-13) 9.3.0
> 
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>

I'll tidy this up whilst applying assuming nothing else comes up.
No comment on it's validity as a warning, but in my view it
is always squashing warnings to keep the noise low for any
more useful ones (as long as it's not too costly).

Jonathan

> 
> 
> cppcheck warnings: (new ones prefixed by >>)
> 
> >> drivers/iio/chemical/scd30_core.c:93:31: warning: Clarify calculation precedence for '&' and '?'. [clarifyCalculation]  
>         sign = float32 & BIT(31) ? -1 : 1,
>                                  ^
> 
> vim +93 drivers/iio/chemical/scd30_core.c
> 
>     87	
>     88	/* simplified float to fixed point conversion with a scaling factor of 0.01 */
>     89	static int scd30_float_to_fp(int float32)
>     90	{
>     91		int fraction, shift,
>     92		    mantissa = float32 & GENMASK(22, 0),
>   > 93		    sign = float32 & BIT(31) ? -1 : 1,  
>     94		    exp = (float32 & ~BIT(31)) >> 23;
>     95	
>     96		/* special case 0 */
>     97		if (!exp && !mantissa)
>     98			return 0;
>     99	
>    100		exp -= 127;
>    101		if (exp < 0) {
>    102			exp = -exp;
>    103			/* return values ranging from 1 to 99 */
>    104			return sign * ((((BIT(23) + mantissa) * 100) >> 23) >> exp);
>    105		}
>    106	
>    107		/* return values starting at 100 */
>    108		shift = 23 - exp;
>    109		float32 = BIT(exp) + (mantissa >> shift);
>    110		fraction = mantissa & GENMASK(shift - 1, 0);
>    111	
>    112		return sign * (float32 * 100 + ((fraction * 100) >> shift));
>    113	}
>    114	
> 
> ---
> 0-DAY CI Kernel Test Service, Intel Corporation
> https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org


WARNING: multiple messages have this Message-ID (diff)
From: Jonathan Cameron <jic23@kernel.org>
To: kbuild-all@lists.01.org
Subject: Re: [PATCH v5 1/4] iio: chemical: scd30: add core driver
Date: Sun, 14 Jun 2020 14:15:46 +0100	[thread overview]
Message-ID: <20200614141546.7a1af2f5@archlinux> (raw)
In-Reply-To: <202006090426.ENCJHJ1n%lkp@intel.com>

[-- Attachment #1: Type: text/plain, Size: 2548 bytes --]

On Tue, 9 Jun 2020 04:18:56 +0800
kernel test robot <lkp@intel.com> wrote:

> Hi Tomasz,
> 
> I love your patch! Perhaps something to improve:
> 
> [auto build test WARNING on iio/togreg]
> [also build test WARNING on robh/for-next linux/master v5.7]
> [if your patch is applied to the wrong git tree, please drop us a note to help
> improve the system. BTW, we also suggest to use '--base' option to specify the
> base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
> 
> url:    https://github.com/0day-ci/linux/commits/Tomasz-Duszynski/Add-support-for-SCD30-sensor/20200608-020304
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git togreg
> compiler: gcc-9 (Debian 9.3.0-13) 9.3.0
> 
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>

I'll tidy this up whilst applying assuming nothing else comes up.
No comment on it's validity as a warning, but in my view it
is always squashing warnings to keep the noise low for any
more useful ones (as long as it's not too costly).

Jonathan

> 
> 
> cppcheck warnings: (new ones prefixed by >>)
> 
> >> drivers/iio/chemical/scd30_core.c:93:31: warning: Clarify calculation precedence for '&' and '?'. [clarifyCalculation]  
>         sign = float32 & BIT(31) ? -1 : 1,
>                                  ^
> 
> vim +93 drivers/iio/chemical/scd30_core.c
> 
>     87	
>     88	/* simplified float to fixed point conversion with a scaling factor of 0.01 */
>     89	static int scd30_float_to_fp(int float32)
>     90	{
>     91		int fraction, shift,
>     92		    mantissa = float32 & GENMASK(22, 0),
>   > 93		    sign = float32 & BIT(31) ? -1 : 1,  
>     94		    exp = (float32 & ~BIT(31)) >> 23;
>     95	
>     96		/* special case 0 */
>     97		if (!exp && !mantissa)
>     98			return 0;
>     99	
>    100		exp -= 127;
>    101		if (exp < 0) {
>    102			exp = -exp;
>    103			/* return values ranging from 1 to 99 */
>    104			return sign * ((((BIT(23) + mantissa) * 100) >> 23) >> exp);
>    105		}
>    106	
>    107		/* return values starting at 100 */
>    108		shift = 23 - exp;
>    109		float32 = BIT(exp) + (mantissa >> shift);
>    110		fraction = mantissa & GENMASK(shift - 1, 0);
>    111	
>    112		return sign * (float32 * 100 + ((fraction * 100) >> shift));
>    113	}
>    114	
> 
> ---
> 0-DAY CI Kernel Test Service, Intel Corporation
> https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

  reply	other threads:[~2020-06-14 13:15 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-07 17:58 [PATCH v5 1/4] iio: chemical: scd30: add core driver Tomasz Duszynski
2020-06-08 20:18 ` kernel test robot
2020-06-08 20:18   ` kernel test robot
2020-06-14 13:15   ` Jonathan Cameron [this message]
2020-06-14 13:15     ` Jonathan Cameron
2020-06-20 16:25 ` Jonathan Cameron
2020-06-21 15:40   ` Tomasz Duszynski

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=20200614141546.7a1af2f5@archlinux \
    --to=jic23@kernel.org \
    --cc=andy.shevchenko@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=kbuild-all@lists.01.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=pmeerw@pmeerw.net \
    --cc=robh+dt@kernel.org \
    --cc=tomasz.duszynski@octakon.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.