Re: [PATCH v5 1/4] iio: chemical: scd30: add core driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 9 Jun 2020 04:18:56 +0800
kernel test robot <lkp@xxxxxxxxx> 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@xxxxxxxxx>

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@xxxxxxxxxxxx




[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux