Re: [PATCH v3] usb: dwc2: dwc2_vbus_supply_init: fix error check

From: kbuild test robot
Date: Fri Mar 23 2018 - 20:25:28 EST


Hi Tomeu,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on balbi-usb/next]
[also build test WARNING on next-20180323]
[cannot apply to v4.16-rc6]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Tomeu-Vizoso/usb-dwc2-dwc2_vbus_supply_init-fix-error-check/20180324-063752
base: https://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git next


coccinelle warnings: (new ones prefixed by >>)

>> drivers/usb/dwc2/hcd.c:367:9-16: ERROR: PTR_ERR applied after initialization to constant on line 366

vim +367 drivers/usb/dwc2/hcd.c

358
359 static int dwc2_vbus_supply_init(struct dwc2_hsotg *hsotg)
360 {
361 hsotg->vbus_supply = devm_regulator_get_optional(hsotg->dev, "vbus");
362 if (PTR_ERR(hsotg->vbus_supply) == -ENODEV) {
363 hsotg->vbus_supply = NULL;
364 return 0;
365 } else if (IS_ERR(hsotg->vbus_supply)) {
> 366 hsotg->vbus_supply = NULL;
> 367 return PTR_ERR(hsotg->vbus_supply);
368 }
369
370 return regulator_enable(hsotg->vbus_supply);
371 }
372

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