[balbi-usb:testing/next 5/10] drivers/usb/dwc3/dwc3-meson-g12a.c:421:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is false

3 views
Skip to first unread message

kbuild test robot

unread,
Feb 9, 2020, 9:03:42 PM2/9/20
to kbu...@lists.01.org, Nick Desaulniers, clang-bu...@googlegroups.com
CC: kbuil...@lists.01.org
CC: linu...@vger.kernel.org
CC: linux...@vger.kernel.org
CC: Felipe Balbi <felipe...@linux.intel.com>
TO: Hanjie Lin <hanji...@amlogic.com>
CC: Felipe Balbi <ba...@kernel.org>
CC: Yue Wang <yue....@amlogic.com>
CC: Martin Blumenstingl <martin.bl...@googlemail.com>

tree: https://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git testing/next
head: b081f1dc121c0bdeacc45cf02c35d1ee95120680
commit: 729149c53f048f16aff9e662bf444c275b59ba8a [5/10] usb: dwc3: Add Amlogic A1 DWC3 glue
config: arm64-defconfig (attached as .config)
compiler: clang version 11.0.0 (git://gitmirror/llvm_project 4dcc029edbe4bd5e30d4f0cdcf123ea4ed2b6418)
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
git checkout 729149c53f048f16aff9e662bf444c275b59ba8a
# save the attached .config to linux build tree
make.cross ARCH=arm64

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <l...@intel.com>

All warnings (new ones prefixed by >>):

>> drivers/usb/dwc3/dwc3-meson-g12a.c:421:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
if (priv->otg_mode == USB_DR_MODE_OTG) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/usb/dwc3/dwc3-meson-g12a.c:455:9: note: uninitialized use occurs here
return ret;
^~~
drivers/usb/dwc3/dwc3-meson-g12a.c:421:2: note: remove the 'if' if its condition is always true
if (priv->otg_mode == USB_DR_MODE_OTG) {
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/usb/dwc3/dwc3-meson-g12a.c:415:9: note: initialize the variable 'ret' to silence this warning
int ret, irq;
^
= 0
1 warning generated.

vim +421 drivers/usb/dwc3/dwc3-meson-g12a.c

410
411 static int dwc3_meson_g12a_otg_init(struct platform_device *pdev,
412 struct dwc3_meson_g12a *priv)
413 {
414 enum phy_mode otg_id;
415 int ret, irq;
416 struct device *dev = &pdev->dev;
417
418 if (!priv->drvdata->otg_switch_supported)
419 return 0;
420
> 421 if (priv->otg_mode == USB_DR_MODE_OTG) {
422 /* Ack irq before registering */
423 regmap_update_bits(priv->regmap, USB_R5,
424 USB_R5_ID_DIG_IRQ, 0);
425
426 irq = platform_get_irq(pdev, 0);
427 ret = devm_request_threaded_irq(&pdev->dev, irq, NULL,
428 dwc3_meson_g12a_irq_thread,
429 IRQF_ONESHOT, pdev->name, priv);
430 if (ret)
431 return ret;
432 }
433
434 /* Setup OTG mode corresponding to the ID pin */
435 if (priv->otg_mode == USB_DR_MODE_OTG) {
436 otg_id = dwc3_meson_g12a_get_id(priv);
437 if (otg_id != priv->otg_phy_mode) {
438 if (dwc3_meson_g12a_otg_mode_set(priv, otg_id))
439 dev_warn(dev, "Failed to switch OTG mode\n");
440 }
441 }
442
443 /* Setup role switcher */
444 priv->switch_desc.usb2_port = dwc3_meson_g12_find_child(dev,
445 "snps,dwc3");
446 priv->switch_desc.udc = dwc3_meson_g12_find_child(dev, "snps,dwc2");
447 priv->switch_desc.allow_userspace_control = true;
448 priv->switch_desc.set = dwc3_meson_g12a_role_set;
449 priv->switch_desc.get = dwc3_meson_g12a_role_get;
450
451 priv->role_switch = usb_role_switch_register(dev, &priv->switch_desc);
452 if (IS_ERR(priv->role_switch))
453 dev_warn(dev, "Unable to register Role Switch\n");
454
455 return ret;
456 }
457

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuil...@lists.01.org
.config.gz

Nathan Chancellor

unread,
Feb 10, 2020, 6:01:47 PM2/10/20
to kbuild test robot, kbu...@lists.01.org, Nick Desaulniers, clang-bu...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages