linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [linux-next:master 2223/2463] drivers/extcon/extcon-usbc-tusb320.c:250:15: warning: cast to smaller integer type 'enum tusb320_type' from 'const void *'
@ 2021-09-16 15:57 ` kernel test robot
  2021-09-23  1:44   ` Chanwoo Choi
  0 siblings, 1 reply; 2+ messages in thread
From: kernel test robot @ 2021-09-16 15:57 UTC (permalink / raw)
  To: Yassine Oudjana
  Cc: llvm, kbuild-all, Linux Memory Management List, Chanwoo Choi

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

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   368847b165bbfbdcf0bd4c96b167893dcdb13aba
commit: 2bd5f4798ae081e30e61668ae016ca473812acce [2223/2463] extcon: usbc-tusb320: Add support for TUSB320L
config: x86_64-randconfig-r034-20210916 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project c8b3d7d6d6de37af68b2f379d0e37304f78e115f)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=2bd5f4798ae081e30e61668ae016ca473812acce
        git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
        git fetch --no-tags linux-next master
        git checkout 2bd5f4798ae081e30e61668ae016ca473812acce
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=x86_64 

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

All warnings (new ones prefixed by >>):

>> drivers/extcon/extcon-usbc-tusb320.c:250:15: warning: cast to smaller integer type 'enum tusb320_type' from 'const void *' [-Wvoid-pointer-to-enum-cast]
           priv->type = (enum tusb320_type)match_data;
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   1 warning generated.


vim +250 drivers/extcon/extcon-usbc-tusb320.c

   224	
   225	static int tusb320_extcon_probe(struct i2c_client *client,
   226					const struct i2c_device_id *id)
   227	{
   228		struct tusb320_priv *priv;
   229		const void *match_data;
   230		unsigned int revision;
   231		int ret;
   232	
   233		priv = devm_kzalloc(&client->dev, sizeof(*priv), GFP_KERNEL);
   234		if (!priv)
   235			return -ENOMEM;
   236		priv->dev = &client->dev;
   237	
   238		priv->regmap = devm_regmap_init_i2c(client, &tusb320_regmap_config);
   239		if (IS_ERR(priv->regmap))
   240			return PTR_ERR(priv->regmap);
   241	
   242		ret = tusb320_check_signature(priv);
   243		if (ret)
   244			return ret;
   245	
   246		match_data = device_get_match_data(&client->dev);
   247		if (!match_data)
   248			return -EINVAL;
   249	
 > 250		priv->type = (enum tusb320_type)match_data;
   251	
   252		priv->edev = devm_extcon_dev_allocate(priv->dev, tusb320_extcon_cable);
   253		if (IS_ERR(priv->edev)) {
   254			dev_err(priv->dev, "failed to allocate extcon device\n");
   255			return PTR_ERR(priv->edev);
   256		}
   257	
   258		if (priv->type == TYPE_TUSB320L) {
   259			ret = regmap_read(priv->regmap, TUSB320L_REGA0_REVISION, &revision);
   260	
   261			if (ret)
   262				dev_warn(priv->dev,
   263					"failed to read revision register: %d\n", ret);
   264			else
   265				dev_info(priv->dev, "chip revision %d\n", revision);
   266		}
   267	
   268		ret = devm_extcon_dev_register(priv->dev, priv->edev);
   269		if (ret < 0) {
   270			dev_err(priv->dev, "failed to register extcon device\n");
   271			return ret;
   272		}
   273	
   274		extcon_set_property_capability(priv->edev, EXTCON_USB,
   275					       EXTCON_PROP_USB_TYPEC_POLARITY);
   276		extcon_set_property_capability(priv->edev, EXTCON_USB_HOST,
   277					       EXTCON_PROP_USB_TYPEC_POLARITY);
   278	
   279		/* update initial state */
   280		tusb320_irq_handler(client->irq, priv);
   281	
   282		/* Reset chip to its default state */
   283		ret = tusb320_reset(priv);
   284		if (ret)
   285			dev_warn(priv->dev, "failed to reset chip: %d\n", ret);
   286		else
   287			/*
   288			 * State and polarity might change after a reset, so update
   289			 * them again and make sure the interrupt status bit is cleared.
   290			 */
   291			tusb320_irq_handler(client->irq, priv);
   292	
   293		ret = devm_request_threaded_irq(priv->dev, client->irq, NULL,
   294						tusb320_irq_handler,
   295						IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
   296						client->name, priv);
   297	
   298		return ret;
   299	}
   300	

---
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: 31365 bytes --]

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

* Re: [linux-next:master 2223/2463] drivers/extcon/extcon-usbc-tusb320.c:250:15: warning: cast to smaller integer type 'enum tusb320_type' from 'const void *'
  2021-09-16 15:57 ` [linux-next:master 2223/2463] drivers/extcon/extcon-usbc-tusb320.c:250:15: warning: cast to smaller integer type 'enum tusb320_type' from 'const void *' kernel test robot
@ 2021-09-23  1:44   ` Chanwoo Choi
  0 siblings, 0 replies; 2+ messages in thread
From: Chanwoo Choi @ 2021-09-23  1:44 UTC (permalink / raw)
  To: kernel test robot, Yassine Oudjana
  Cc: llvm, kbuild-all, Linux Memory Management List

Hi Yassine,

Please fix this issue. And then resend your patches.

On 9/17/21 12:57 AM, kernel test robot wrote:
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
> head:   368847b165bbfbdcf0bd4c96b167893dcdb13aba
> commit: 2bd5f4798ae081e30e61668ae016ca473812acce [2223/2463] extcon: usbc-tusb320: Add support for TUSB320L
> config: x86_64-randconfig-r034-20210916 (attached as .config)
> compiler: clang version 14.0.0 (https://protect2.fireeye.com/v1/url?k=323f6eaa-6da457ec-323ee5e5-0cc47a3003e8-696b222531acb98d&q=1&e=8a6a2762-9bac-4fe5-8382-60867b701b77&u=https%3A%2F%2Fgithub.com%2Fllvm%2Fllvm-project c8b3d7d6d6de37af68b2f379d0e37304f78e115f)
> reproduce (this is a W=1 build):
>         wget https://protect2.fireeye.com/v1/url?k=8c79ba47-d3e28301-8c783108-0cc47a3003e8-8233ac4fdd3d567e&q=1&e=8a6a2762-9bac-4fe5-8382-60867b701b77&u=https%3A%2F%2Fraw.githubusercontent.com%2Fintel%2Flkp-tests%2Fmaster%2Fsbin%2Fmake.cross -O ~/bin/make.cross
>         chmod +x ~/bin/make.cross
>         # https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=2bd5f4798ae081e30e61668ae016ca473812acce
>         git remote add linux-next https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
>         git fetch --no-tags linux-next master
>         git checkout 2bd5f4798ae081e30e61668ae016ca473812acce
>         # save the attached .config to linux build tree
>         COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=x86_64 
> 
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>
> 
> All warnings (new ones prefixed by >>):
> 
>>> drivers/extcon/extcon-usbc-tusb320.c:250:15: warning: cast to smaller integer type 'enum tusb320_type' from 'const void *' [-Wvoid-pointer-to-enum-cast]
>            priv->type = (enum tusb320_type)match_data;
>                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>    1 warning generated.
> 
> 
> vim +250 drivers/extcon/extcon-usbc-tusb320.c
> 
>    224	
>    225	static int tusb320_extcon_probe(struct i2c_client *client,
>    226					const struct i2c_device_id *id)
>    227	{
>    228		struct tusb320_priv *priv;
>    229		const void *match_data;
>    230		unsigned int revision;
>    231		int ret;
>    232	
>    233		priv = devm_kzalloc(&client->dev, sizeof(*priv), GFP_KERNEL);
>    234		if (!priv)
>    235			return -ENOMEM;
>    236		priv->dev = &client->dev;
>    237	
>    238		priv->regmap = devm_regmap_init_i2c(client, &tusb320_regmap_config);
>    239		if (IS_ERR(priv->regmap))
>    240			return PTR_ERR(priv->regmap);
>    241	
>    242		ret = tusb320_check_signature(priv);
>    243		if (ret)
>    244			return ret;
>    245	
>    246		match_data = device_get_match_data(&client->dev);
>    247		if (!match_data)
>    248			return -EINVAL;
>    249	
>  > 250		priv->type = (enum tusb320_type)match_data;
>    251	
>    252		priv->edev = devm_extcon_dev_allocate(priv->dev, tusb320_extcon_cable);
>    253		if (IS_ERR(priv->edev)) {
>    254			dev_err(priv->dev, "failed to allocate extcon device\n");
>    255			return PTR_ERR(priv->edev);
>    256		}
>    257	
>    258		if (priv->type == TYPE_TUSB320L) {
>    259			ret = regmap_read(priv->regmap, TUSB320L_REGA0_REVISION, &revision);
>    260	
>    261			if (ret)
>    262				dev_warn(priv->dev,
>    263					"failed to read revision register: %d\n", ret);
>    264			else
>    265				dev_info(priv->dev, "chip revision %d\n", revision);
>    266		}
>    267	
>    268		ret = devm_extcon_dev_register(priv->dev, priv->edev);
>    269		if (ret < 0) {
>    270			dev_err(priv->dev, "failed to register extcon device\n");
>    271			return ret;
>    272		}
>    273	
>    274		extcon_set_property_capability(priv->edev, EXTCON_USB,
>    275					       EXTCON_PROP_USB_TYPEC_POLARITY);
>    276		extcon_set_property_capability(priv->edev, EXTCON_USB_HOST,
>    277					       EXTCON_PROP_USB_TYPEC_POLARITY);
>    278	
>    279		/* update initial state */
>    280		tusb320_irq_handler(client->irq, priv);
>    281	
>    282		/* Reset chip to its default state */
>    283		ret = tusb320_reset(priv);
>    284		if (ret)
>    285			dev_warn(priv->dev, "failed to reset chip: %d\n", ret);
>    286		else
>    287			/*
>    288			 * State and polarity might change after a reset, so update
>    289			 * them again and make sure the interrupt status bit is cleared.
>    290			 */
>    291			tusb320_irq_handler(client->irq, priv);
>    292	
>    293		ret = devm_request_threaded_irq(priv->dev, client->irq, NULL,
>    294						tusb320_irq_handler,
>    295						IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
>    296						client->name, priv);
>    297	
>    298		return ret;
>    299	}
>    300	
> 
> ---
> 0-DAY CI Kernel Test Service, Intel Corporation
> https://protect2.fireeye.com/v1/url?k=9796b83a-c80d817c-97973375-0cc47a3003e8-e9c6ede5e7c8665a&q=1&e=8a6a2762-9bac-4fe5-8382-60867b701b77&u=https%3A%2F%2Flists.01.org%2Fhyperkitty%2Flist%2Fkbuild-all%40lists.01.org
> 


-- 
Best Regards,
Chanwoo Choi
Samsung Electronics


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

end of thread, other threads:[~2021-09-23  1:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20210916155808epcas1p297ee826afd77e98bd9a28aabd151cee6@epcas1p2.samsung.com>
2021-09-16 15:57 ` [linux-next:master 2223/2463] drivers/extcon/extcon-usbc-tusb320.c:250:15: warning: cast to smaller integer type 'enum tusb320_type' from 'const void *' kernel test robot
2021-09-23  1:44   ` Chanwoo Choi

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).