linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [linux-next:master 1467/1905] drivers/hwmon/nct6775-i2c.c:164:15: warning: cast to smaller integer type 'enum kinds' from 'const void *'
@ 2023-11-19  4:09 kernel test robot
  2023-11-20 16:40 ` Rob Herring
  0 siblings, 1 reply; 3+ messages in thread
From: kernel test robot @ 2023-11-19  4:09 UTC (permalink / raw)
  To: Rob Herring
  Cc: llvm, oe-kbuild-all, Linux Memory Management List, Guenter Roeck

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   eff99d8edbed7918317331ebd1e365d8e955d65e
commit: 0a7093e69c1eb508d699d6076013706b0c523597 [1467/1905] hwmon: nct6775-i2c: Use i2c_get_match_data()
config: x86_64-allmodconfig (https://download.01.org/0day-ci/archive/20231119/202311191205.EDRfQlJF-lkp@intel.com/config)
compiler: clang version 16.0.4 (https://github.com/llvm/llvm-project.git ae42196bc493ffe877a7e3dff8be32035dea4d07)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231119/202311191205.EDRfQlJF-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202311191205.EDRfQlJF-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/hwmon/nct6775-i2c.c:164:15: warning: cast to smaller integer type 'enum kinds' from 'const void *' [-Wvoid-pointer-to-enum-cast]
           data->kind = (enum kinds)i2c_get_match_data(client);
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   1 warning generated.


vim +164 drivers/hwmon/nct6775-i2c.c

   154	
   155	static int nct6775_i2c_probe(struct i2c_client *client)
   156	{
   157		struct nct6775_data *data;
   158		struct device *dev = &client->dev;
   159	
   160		data = devm_kzalloc(&client->dev, sizeof(*data), GFP_KERNEL);
   161		if (!data)
   162			return -ENOMEM;
   163	
 > 164		data->kind = (enum kinds)i2c_get_match_data(client);
   165		data->read_only = true;
   166		data->driver_data = client;
   167		data->driver_init = nct6775_i2c_probe_init;
   168	
   169		return nct6775_probe(dev, data, &nct6775_i2c_regmap_config);
   170	}
   171	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki


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

* Re: [linux-next:master 1467/1905] drivers/hwmon/nct6775-i2c.c:164:15: warning: cast to smaller integer type 'enum kinds' from 'const void *'
  2023-11-19  4:09 [linux-next:master 1467/1905] drivers/hwmon/nct6775-i2c.c:164:15: warning: cast to smaller integer type 'enum kinds' from 'const void *' kernel test robot
@ 2023-11-20 16:40 ` Rob Herring
  2023-11-20 17:15   ` Guenter Roeck
  0 siblings, 1 reply; 3+ messages in thread
From: Rob Herring @ 2023-11-20 16:40 UTC (permalink / raw)
  To: kernel test robot
  Cc: llvm, oe-kbuild-all, Linux Memory Management List, Guenter Roeck

On Sat, Nov 18, 2023 at 9:10 PM kernel test robot <lkp@intel.com> wrote:
>
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
> head:   eff99d8edbed7918317331ebd1e365d8e955d65e
> commit: 0a7093e69c1eb508d699d6076013706b0c523597 [1467/1905] hwmon: nct6775-i2c: Use i2c_get_match_data()
> config: x86_64-allmodconfig (https://download.01.org/0day-ci/archive/20231119/202311191205.EDRfQlJF-lkp@intel.com/config)
> compiler: clang version 16.0.4 (https://github.com/llvm/llvm-project.git ae42196bc493ffe877a7e3dff8be32035dea4d07)
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231119/202311191205.EDRfQlJF-lkp@intel.com/reproduce)
>
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp@intel.com>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202311191205.EDRfQlJF-lkp@intel.com/
>
> All warnings (new ones prefixed by >>):
>
> >> drivers/hwmon/nct6775-i2c.c:164:15: warning: cast to smaller integer type 'enum kinds' from 'const void *' [-Wvoid-pointer-to-enum-cast]
>            data->kind = (enum kinds)i2c_get_match_data(client);
>                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    1 warning generated.

I thought I had fixed all these...

However, there's also been discussion[1] to turn this warning off.

Rob

[1] https://lore.kernel.org/all/CAKwvOd=1otHgNkJf7wBajDrGmRNQduvR5ie_XgJMPPWT6+n_mQ@mail.gmail.com/


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

* Re: [linux-next:master 1467/1905] drivers/hwmon/nct6775-i2c.c:164:15: warning: cast to smaller integer type 'enum kinds' from 'const void *'
  2023-11-20 16:40 ` Rob Herring
@ 2023-11-20 17:15   ` Guenter Roeck
  0 siblings, 0 replies; 3+ messages in thread
From: Guenter Roeck @ 2023-11-20 17:15 UTC (permalink / raw)
  To: Rob Herring, kernel test robot
  Cc: llvm, oe-kbuild-all, Linux Memory Management List

On 11/20/23 08:40, Rob Herring wrote:
> On Sat, Nov 18, 2023 at 9:10 PM kernel test robot <lkp@intel.com> wrote:
>>
>> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
>> head:   eff99d8edbed7918317331ebd1e365d8e955d65e
>> commit: 0a7093e69c1eb508d699d6076013706b0c523597 [1467/1905] hwmon: nct6775-i2c: Use i2c_get_match_data()
>> config: x86_64-allmodconfig (https://download.01.org/0day-ci/archive/20231119/202311191205.EDRfQlJF-lkp@intel.com/config)
>> compiler: clang version 16.0.4 (https://github.com/llvm/llvm-project.git ae42196bc493ffe877a7e3dff8be32035dea4d07)
>> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231119/202311191205.EDRfQlJF-lkp@intel.com/reproduce)
>>
>> If you fix the issue in a separate patch/commit (i.e. not just a new version of
>> the same patch/commit), kindly add following tags
>> | Reported-by: kernel test robot <lkp@intel.com>
>> | Closes: https://lore.kernel.org/oe-kbuild-all/202311191205.EDRfQlJF-lkp@intel.com/
>>
>> All warnings (new ones prefixed by >>):
>>
>>>> drivers/hwmon/nct6775-i2c.c:164:15: warning: cast to smaller integer type 'enum kinds' from 'const void *' [-Wvoid-pointer-to-enum-cast]
>>             data->kind = (enum kinds)i2c_get_match_data(client);
>>                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>     1 warning generated.
> 
> I thought I had fixed all these...
> 
> However, there's also been discussion[1] to turn this warning off.
> 

This one is only seen with gcc-12+ (the exchange you cited is wrong in that
regard) and with clang. I agree that it is just noise - after all, there _is_
a type cast. Not worth arguing about, though, so I just changed it to use
a double type cast.

Guenter



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

end of thread, other threads:[~2023-11-20 17:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-19  4:09 [linux-next:master 1467/1905] drivers/hwmon/nct6775-i2c.c:164:15: warning: cast to smaller integer type 'enum kinds' from 'const void *' kernel test robot
2023-11-20 16:40 ` Rob Herring
2023-11-20 17:15   ` Guenter Roeck

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