Linux Hardware Monitor development
 help / color / mirror / Atom feed
* [groeck-staging:hwmon-next 77/79] drivers/hwmon/tps23861.c:159:19: sparse: sparse: cast to restricted __le16
@ 2022-07-21 10:41 kernel test robot
  2022-07-21 22:03 ` Alex G.
  0 siblings, 1 reply; 3+ messages in thread
From: kernel test robot @ 2022-07-21 10:41 UTC (permalink / raw)
  To: Alexandru Gagniuc; +Cc: kbuild-all, linux-hwmon, Guenter Roeck

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git hwmon-next
head:   5668b5e6cffd975632ee6c32802d7d877b98e9a4
commit: 7024d59f146ea99d95b7f238e9991f32f31496b0 [77/79] hwmon: (tps23861) fix byte order in current and voltage registers
config: alpha-randconfig-s053-20220720 (https://download.01.org/0day-ci/archive/20220721/202207211843.3aLaNmh9-lkp@intel.com/config)
compiler: alpha-linux-gcc (GCC) 12.1.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # apt-get install sparse
        # sparse version: v0.6.4-39-gce1a6720-dirty
        # https://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git/commit/?id=7024d59f146ea99d95b7f238e9991f32f31496b0
        git remote add groeck-staging https://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git
        git fetch --no-tags groeck-staging hwmon-next
        git checkout 7024d59f146ea99d95b7f238e9991f32f31496b0
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=alpha SHELL=/bin/bash drivers/hwmon/

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>


sparse warnings: (new ones prefixed by >>)
>> drivers/hwmon/tps23861.c:159:19: sparse: sparse: cast to restricted __le16
   drivers/hwmon/tps23861.c:184:19: sparse: sparse: cast to restricted __le16

vim +159 drivers/hwmon/tps23861.c

   139	
   140	static int tps23861_read_voltage(struct tps23861_data *data, int channel,
   141					 long *val)
   142	{
   143		uint16_t regval;
   144		long raw_val;
   145		int err;
   146	
   147		if (channel < TPS23861_NUM_PORTS) {
   148			err = regmap_bulk_read(data->regmap,
   149					       PORT_1_VOLTAGE_LSB + channel * PORT_N_VOLTAGE_LSB_OFFSET,
   150					       &regval, 2);
   151		} else {
   152			err = regmap_bulk_read(data->regmap,
   153					       INPUT_VOLTAGE_LSB,
   154					       &regval, 2);
   155		}
   156		if (err < 0)
   157			return err;
   158	
 > 159		raw_val = le16_to_cpu(regval);
   160		*val = (FIELD_GET(VOLTAGE_CURRENT_MASK, raw_val) * VOLTAGE_LSB) / 1000;
   161	
   162		return 0;
   163	}
   164	

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [groeck-staging:hwmon-next 77/79] drivers/hwmon/tps23861.c:159:19: sparse: sparse: cast to restricted __le16
  2022-07-21 10:41 [groeck-staging:hwmon-next 77/79] drivers/hwmon/tps23861.c:159:19: sparse: sparse: cast to restricted __le16 kernel test robot
@ 2022-07-21 22:03 ` Alex G.
  2022-07-22  0:01   ` Guenter Roeck
  0 siblings, 1 reply; 3+ messages in thread
From: Alex G. @ 2022-07-21 22:03 UTC (permalink / raw)
  To: kernel test robot; +Cc: kbuild-all, linux-hwmon, Guenter Roeck

Hi Guenter,

On 7/21/22 05:41, kernel test robot wrote:
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git hwmon-next
> head:   5668b5e6cffd975632ee6c32802d7d877b98e9a4
> commit: 7024d59f146ea99d95b7f238e9991f32f31496b0 [77/79] hwmon: (tps23861) fix byte order in current and voltage registers
> config: alpha-randconfig-s053-20220720 (https://download.01.org/0day-ci/archive/20220721/202207211843.3aLaNmh9-lkp@intel.com/config)
> compiler: alpha-linux-gcc (GCC) 12.1.0
> reproduce:
>          wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>          chmod +x ~/bin/make.cross
>          # apt-get install sparse
>          # sparse version: v0.6.4-39-gce1a6720-dirty
>          # https://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git/commit/?id=7024d59f146ea99d95b7f238e9991f32f31496b0
>          git remote add groeck-staging https://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git
>          git fetch --no-tags groeck-staging hwmon-next
>          git checkout 7024d59f146ea99d95b7f238e9991f32f31496b0
>          # save the config file
>          mkdir build_dir && cp config build_dir/.config
>          COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=alpha SHELL=/bin/bash drivers/hwmon/
> 
> If you fix the issue, kindly add following tag where applicable
> Reported-by: kernel test robot <lkp@intel.com>
> 
> 
> sparse warnings: (new ones prefixed by >>)
>>> drivers/hwmon/tps23861.c:159:19: sparse: sparse: cast to restricted __le16
>     drivers/hwmon/tps23861.c:184:19: sparse: sparse: cast to restricted __le16

I'm sorry about this. These warnings caught me by surprise. I checked 
that changing the type from "uint16_t" to "__le16" silences sparse. It
feels like a false positive. Should I worry about this?

Alex

> vim +159 drivers/hwmon/tps23861.c
> 
>     139	
>     140	static int tps23861_read_voltage(struct tps23861_data *data, int channel,
>     141					 long *val)
>     142	{
>     143		uint16_t regval;
>     144		long raw_val;
>     145		int err;
>     146	
>     147		if (channel < TPS23861_NUM_PORTS) {
>     148			err = regmap_bulk_read(data->regmap,
>     149					       PORT_1_VOLTAGE_LSB + channel * PORT_N_VOLTAGE_LSB_OFFSET,
>     150					       &regval, 2);
>     151		} else {
>     152			err = regmap_bulk_read(data->regmap,
>     153					       INPUT_VOLTAGE_LSB,
>     154					       &regval, 2);
>     155		}
>     156		if (err < 0)
>     157			return err;
>     158	
>   > 159		raw_val = le16_to_cpu(regval);
>     160		*val = (FIELD_GET(VOLTAGE_CURRENT_MASK, raw_val) * VOLTAGE_LSB) / 1000;
>     161	
>     162		return 0;
>     163	}
>     164	
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [groeck-staging:hwmon-next 77/79] drivers/hwmon/tps23861.c:159:19: sparse: sparse: cast to restricted __le16
  2022-07-21 22:03 ` Alex G.
@ 2022-07-22  0:01   ` Guenter Roeck
  0 siblings, 0 replies; 3+ messages in thread
From: Guenter Roeck @ 2022-07-22  0:01 UTC (permalink / raw)
  To: Alex G., kernel test robot; +Cc: kbuild-all, linux-hwmon

On 7/21/22 15:03, Alex G. wrote:
> Hi Guenter,
> 
> On 7/21/22 05:41, kernel test robot wrote:
>> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git hwmon-next
>> head:   5668b5e6cffd975632ee6c32802d7d877b98e9a4
>> commit: 7024d59f146ea99d95b7f238e9991f32f31496b0 [77/79] hwmon: (tps23861) fix byte order in current and voltage registers
>> config: alpha-randconfig-s053-20220720 (https://download.01.org/0day-ci/archive/20220721/202207211843.3aLaNmh9-lkp@intel.com/config)
>> compiler: alpha-linux-gcc (GCC) 12.1.0
>> reproduce:
>>          wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>>          chmod +x ~/bin/make.cross
>>          # apt-get install sparse
>>          # sparse version: v0.6.4-39-gce1a6720-dirty
>>          # https://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git/commit/?id=7024d59f146ea99d95b7f238e9991f32f31496b0
>>          git remote add groeck-staging https://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git
>>          git fetch --no-tags groeck-staging hwmon-next
>>          git checkout 7024d59f146ea99d95b7f238e9991f32f31496b0
>>          # save the config file
>>          mkdir build_dir && cp config build_dir/.config
>>          COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=alpha SHELL=/bin/bash drivers/hwmon/
>>
>> If you fix the issue, kindly add following tag where applicable
>> Reported-by: kernel test robot <lkp@intel.com>
>>
>>
>> sparse warnings: (new ones prefixed by >>)
>>>> drivers/hwmon/tps23861.c:159:19: sparse: sparse: cast to restricted __le16
>>     drivers/hwmon/tps23861.c:184:19: sparse: sparse: cast to restricted __le16
> 
> I'm sorry about this. These warnings caught me by surprise. I checked that changing the type from "uint16_t" to "__le16" silences sparse. It
> feels like a false positive. Should I worry about this?
> 

It is not a false positive. Those warnings and variable types exist for a reason.
No worries, though, I already fixed it up.

Guenter

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-07-22  0:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-21 10:41 [groeck-staging:hwmon-next 77/79] drivers/hwmon/tps23861.c:159:19: sparse: sparse: cast to restricted __le16 kernel test robot
2022-07-21 22:03 ` Alex G.
2022-07-22  0:01   ` Guenter Roeck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox