Thread (2 messages) flat view 2 messages, 2 authors, 2021-09-23

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 *'

From: Chanwoo Choi <cw00.choi@samsung.com>
Date: 2021-09-23 01:24:01
Also in: llvm, oe-kbuild-all

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 <redacted>

All warnings (new ones prefixed by >>):
quoted
quoted
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help