[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: kernel test robot <hidden>
Date: 2021-09-16 15:57:57
Also in:
llvm, oe-kbuild-all
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 <redacted> All warnings (new ones prefixed by >>):
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://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org Attachments
- .config.gz [application/gzip] 31365 bytes