[balbi-usb:testing/next 46/52] drivers/usb/phy/phy-tahvo.c:433:9: warning: 'ret' may be used uninitialized in this function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



tree:   https://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git testing/next
head:   f463883ae099b7e98e8ea0a6b9c8dbd05217d94a
commit: 649e479cc765d18030b885796e8ee160b7247d40 [46/52] usb: phy: tahvo: fix error handling in tahvo_usb_probe()
config: x86_64-randconfig-x018-201743 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
        git checkout 649e479cc765d18030b885796e8ee160b7247d40
        # save the attached .config to linux build tree
        make ARCH=x86_64 

Note: it may well be a FALSE warning. FWIW you are at least aware of it now.
http://gcc.gnu.org/wiki/Better_Uninitialized_Warnings

All warnings (new ones prefixed by >>):

   Cyclomatic Complexity 1 include/linux/string.h:strnlen
   Cyclomatic Complexity 2 include/linux/string.h:strlen
   Cyclomatic Complexity 1 include/linux/device.h:dev_get_drvdata
   Cyclomatic Complexity 1 include/linux/device.h:dev_set_drvdata
   Cyclomatic Complexity 1 include/linux/platform_device.h:platform_get_drvdata
   Cyclomatic Complexity 1 drivers/usb/phy/phy-tahvo.c:tahvo_usb_stop_host
   Cyclomatic Complexity 2 drivers/usb/phy/phy-tahvo.c:tahvo_usb_stop_peripheral
   Cyclomatic Complexity 2 drivers/usb/phy/phy-tahvo.c:tahvo_usb_power_off
   Cyclomatic Complexity 9 drivers/usb/phy/phy-tahvo.c:check_vbus_state
   Cyclomatic Complexity 1 drivers/usb/phy/phy-tahvo.c:tahvo_usb_become_host
   Cyclomatic Complexity 1 drivers/usb/phy/phy-tahvo.c:tahvo_usb_become_peripheral
   Cyclomatic Complexity 9 drivers/usb/phy/phy-tahvo.c:otg_mode_store
   Cyclomatic Complexity 1 drivers/usb/phy/phy-tahvo.c:tahvo_usb_vbus_interrupt
   Cyclomatic Complexity 3 drivers/usb/phy/phy-tahvo.c:otg_mode_show
   Cyclomatic Complexity 2 drivers/usb/phy/phy-tahvo.c:vbus_state_show
   Cyclomatic Complexity 1 include/linux/err.h:IS_ERR
   Cyclomatic Complexity 2 drivers/usb/phy/phy-tahvo.c:tahvo_usb_remove
   Cyclomatic Complexity 5 drivers/usb/phy/phy-tahvo.c:tahvo_usb_set_peripheral
   Cyclomatic Complexity 5 drivers/usb/phy/phy-tahvo.c:tahvo_usb_set_host
   Cyclomatic Complexity 3 drivers/usb/phy/phy-tahvo.c:tahvo_usb_set_suspend
   Cyclomatic Complexity 1 include/linux/device.h:devm_kzalloc
   Cyclomatic Complexity 10 drivers/usb/phy/phy-tahvo.c:tahvo_usb_probe
   Cyclomatic Complexity 1 drivers/usb/phy/phy-tahvo.c:tahvo_usb_driver_init
   Cyclomatic Complexity 1 drivers/usb/phy/phy-tahvo.c:tahvo_usb_driver_exit
   drivers/usb/phy/phy-tahvo.c: In function 'tahvo_usb_probe':
>> drivers/usb/phy/phy-tahvo.c:433:9: warning: 'ret' may be used uninitialized in this function [-Wmaybe-uninitialized]
     return ret;
            ^~~

vim +/ret +433 drivers/usb/phy/phy-tahvo.c

9ba96ae5 Aaro Koskinen      2013-12-06  356  
9ba96ae5 Aaro Koskinen      2013-12-06  357  	mutex_init(&tu->serialize);
9ba96ae5 Aaro Koskinen      2013-12-06  358  
9ba96ae5 Aaro Koskinen      2013-12-06  359  	tu->ick = devm_clk_get(&pdev->dev, "usb_l4_ick");
9ba96ae5 Aaro Koskinen      2013-12-06  360  	if (!IS_ERR(tu->ick))
9ba96ae5 Aaro Koskinen      2013-12-06  361  		clk_enable(tu->ick);
9ba96ae5 Aaro Koskinen      2013-12-06  362  
9ba96ae5 Aaro Koskinen      2013-12-06  363  	/*
9ba96ae5 Aaro Koskinen      2013-12-06  364  	 * Set initial state, so that we generate kevents only on state changes.
9ba96ae5 Aaro Koskinen      2013-12-06  365  	 */
9ba96ae5 Aaro Koskinen      2013-12-06  366  	tu->vbus_state = retu_read(rdev, TAHVO_REG_IDSR) & TAHVO_STAT_VBUS;
9ba96ae5 Aaro Koskinen      2013-12-06  367  
860d2686 Chanwoo Choi       2015-07-01  368  	tu->extcon = devm_extcon_dev_allocate(&pdev->dev, tahvo_cable);
860d2686 Chanwoo Choi       2015-07-01  369  	if (IS_ERR(tu->extcon)) {
860d2686 Chanwoo Choi       2015-07-01  370  		dev_err(&pdev->dev, "failed to allocate memory for extcon\n");
649e479c Alexey Khoroshilov 2017-10-21  371  		goto err_disable_clk;
860d2686 Chanwoo Choi       2015-07-01  372  	}
9ba96ae5 Aaro Koskinen      2013-12-06  373  
860d2686 Chanwoo Choi       2015-07-01  374  	ret = devm_extcon_dev_register(&pdev->dev, tu->extcon);
9ba96ae5 Aaro Koskinen      2013-12-06  375  	if (ret) {
9ba96ae5 Aaro Koskinen      2013-12-06  376  		dev_err(&pdev->dev, "could not register extcon device: %d\n",
9ba96ae5 Aaro Koskinen      2013-12-06  377  			ret);
9ba96ae5 Aaro Koskinen      2013-12-06  378  		goto err_disable_clk;
9ba96ae5 Aaro Koskinen      2013-12-06  379  	}
9ba96ae5 Aaro Koskinen      2013-12-06  380  
9ba96ae5 Aaro Koskinen      2013-12-06  381  	/* Set the initial cable state. */
746c9085 Chanwoo Choi       2017-01-16  382  	extcon_set_state_sync(tu->extcon, EXTCON_USB_HOST,
9ba96ae5 Aaro Koskinen      2013-12-06  383  			       tu->tahvo_mode == TAHVO_MODE_HOST);
746c9085 Chanwoo Choi       2017-01-16  384  	extcon_set_state_sync(tu->extcon, EXTCON_USB, tu->vbus_state);
9ba96ae5 Aaro Koskinen      2013-12-06  385  
9ba96ae5 Aaro Koskinen      2013-12-06  386  	/* Create OTG interface */
9ba96ae5 Aaro Koskinen      2013-12-06  387  	tahvo_usb_power_off(tu);
9ba96ae5 Aaro Koskinen      2013-12-06  388  	tu->phy.dev = &pdev->dev;
e47d9254 Antoine Tenart     2014-10-30  389  	tu->phy.otg->state = OTG_STATE_UNDEFINED;
9ba96ae5 Aaro Koskinen      2013-12-06  390  	tu->phy.label = DRIVER_NAME;
9ba96ae5 Aaro Koskinen      2013-12-06  391  	tu->phy.set_suspend = tahvo_usb_set_suspend;
9ba96ae5 Aaro Koskinen      2013-12-06  392  
19c1eac2 Antoine Tenart     2014-10-30  393  	tu->phy.otg->usb_phy = &tu->phy;
9ba96ae5 Aaro Koskinen      2013-12-06  394  	tu->phy.otg->set_host = tahvo_usb_set_host;
9ba96ae5 Aaro Koskinen      2013-12-06  395  	tu->phy.otg->set_peripheral = tahvo_usb_set_peripheral;
9ba96ae5 Aaro Koskinen      2013-12-06  396  
9ba96ae5 Aaro Koskinen      2013-12-06  397  	ret = usb_add_phy(&tu->phy, USB_PHY_TYPE_USB2);
9ba96ae5 Aaro Koskinen      2013-12-06  398  	if (ret < 0) {
9ba96ae5 Aaro Koskinen      2013-12-06  399  		dev_err(&pdev->dev, "cannot register USB transceiver: %d\n",
9ba96ae5 Aaro Koskinen      2013-12-06  400  			ret);
860d2686 Chanwoo Choi       2015-07-01  401  		goto err_disable_clk;
9ba96ae5 Aaro Koskinen      2013-12-06  402  	}
9ba96ae5 Aaro Koskinen      2013-12-06  403  
9ba96ae5 Aaro Koskinen      2013-12-06  404  	dev_set_drvdata(&pdev->dev, tu);
9ba96ae5 Aaro Koskinen      2013-12-06  405  
9ba96ae5 Aaro Koskinen      2013-12-06  406  	tu->irq = platform_get_irq(pdev, 0);
a81df9ee Fabio Estevam      2015-05-22  407  	ret = request_threaded_irq(tu->irq, NULL, tahvo_usb_vbus_interrupt,
a81df9ee Fabio Estevam      2015-05-22  408  				   IRQF_ONESHOT,
9ba96ae5 Aaro Koskinen      2013-12-06  409  				   "tahvo-vbus", tu);
9ba96ae5 Aaro Koskinen      2013-12-06  410  	if (ret) {
9ba96ae5 Aaro Koskinen      2013-12-06  411  		dev_err(&pdev->dev, "could not register tahvo-vbus irq: %d\n",
9ba96ae5 Aaro Koskinen      2013-12-06  412  			ret);
9ba96ae5 Aaro Koskinen      2013-12-06  413  		goto err_remove_phy;
9ba96ae5 Aaro Koskinen      2013-12-06  414  	}
9ba96ae5 Aaro Koskinen      2013-12-06  415  
9ba96ae5 Aaro Koskinen      2013-12-06  416  	/* Attributes */
9ba96ae5 Aaro Koskinen      2013-12-06  417  	ret = sysfs_create_group(&pdev->dev.kobj, &tahvo_attr_group);
9ba96ae5 Aaro Koskinen      2013-12-06  418  	if (ret) {
9ba96ae5 Aaro Koskinen      2013-12-06  419  		dev_err(&pdev->dev, "cannot create sysfs group: %d\n", ret);
9ba96ae5 Aaro Koskinen      2013-12-06  420  		goto err_free_irq;
9ba96ae5 Aaro Koskinen      2013-12-06  421  	}
9ba96ae5 Aaro Koskinen      2013-12-06  422  
9ba96ae5 Aaro Koskinen      2013-12-06  423  	return 0;
9ba96ae5 Aaro Koskinen      2013-12-06  424  
9ba96ae5 Aaro Koskinen      2013-12-06  425  err_free_irq:
9ba96ae5 Aaro Koskinen      2013-12-06  426  	free_irq(tu->irq, tu);
9ba96ae5 Aaro Koskinen      2013-12-06  427  err_remove_phy:
9ba96ae5 Aaro Koskinen      2013-12-06  428  	usb_remove_phy(&tu->phy);
9ba96ae5 Aaro Koskinen      2013-12-06  429  err_disable_clk:
9ba96ae5 Aaro Koskinen      2013-12-06  430  	if (!IS_ERR(tu->ick))
9ba96ae5 Aaro Koskinen      2013-12-06  431  		clk_disable(tu->ick);
9ba96ae5 Aaro Koskinen      2013-12-06  432  
9ba96ae5 Aaro Koskinen      2013-12-06 @433  	return ret;
9ba96ae5 Aaro Koskinen      2013-12-06  434  }
9ba96ae5 Aaro Koskinen      2013-12-06  435  

:::::: The code at line 433 was first introduced by commit
:::::: 9ba96ae5074c9f15b357919e704ceba2bd34972d usb: omap1: Tahvo USB transceiver driver

:::::: TO: Aaro Koskinen <aaro.koskinen@xxxxxx>
:::::: CC: Felipe Balbi <balbi@xxxxxx>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

Attachment: .config.gz
Description: application/gzip


[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux