Re: [PATCH v11 06/13] usb: dwc3: core: Refactor PHY logic to support Multiport Controller

From: kernel test robot
Date: Tue Sep 19 2023 - 13:27:12 EST


Hi Krishna,

kernel test robot noticed the following build warnings:

[auto build test WARNING on usb/usb-testing]
[also build test WARNING on usb/usb-next usb/usb-linus robh/for-next pza/reset/next linus/master v6.6-rc2 next-20230919]
[cannot apply to pza/imx-drm/next]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Krishna-Kurapati/dt-bindings-usb-qcom-dwc3-Add-bindings-for-SC8280-Multiport/20230828-214326
base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
patch link: https://lore.kernel.org/r/20230828133033.11988-7-quic_kriskura%40quicinc.com
patch subject: [PATCH v11 06/13] usb: dwc3: core: Refactor PHY logic to support Multiport Controller
config: x86_64-randconfig-011-20230902 (https://download.01.org/0day-ci/archive/20230920/202309200156.CxQ3yaLY-lkp@xxxxxxxxx/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20230920/202309200156.CxQ3yaLY-lkp@xxxxxxxxx/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202309200156.CxQ3yaLY-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

drivers/usb/dwc3/core.c: In function 'dwc3_core_get_phy':
>> drivers/usb/dwc3/core.c:1375:53: warning: '%d' directive writing between 1 and 3 bytes into a region of size 2 [-Wformat-overflow=]
1375 | sprintf(phy_name, "usb2-port%d", i);
| ^~
drivers/usb/dwc3/core.c:1375:43: note: directive argument in the range [0, 254]
1375 | sprintf(phy_name, "usb2-port%d", i);
| ^~~~~~~~~~~~~
drivers/usb/dwc3/core.c:1375:25: note: 'sprintf' output between 11 and 13 bytes into a destination of size 11
1375 | sprintf(phy_name, "usb2-port%d", i);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/usb/dwc3/core.c:1390:53: warning: '%d' directive writing between 1 and 3 bytes into a region of size 2 [-Wformat-overflow=]
1390 | sprintf(phy_name, "usb3-port%d", i);
| ^~
drivers/usb/dwc3/core.c:1390:43: note: directive argument in the range [0, 254]
1390 | sprintf(phy_name, "usb3-port%d", i);
| ^~~~~~~~~~~~~
drivers/usb/dwc3/core.c:1390:25: note: 'sprintf' output between 11 and 13 bytes into a destination of size 11
1390 | sprintf(phy_name, "usb3-port%d", i);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


vim +1375 drivers/usb/dwc3/core.c

1338
1339 static int dwc3_core_get_phy(struct dwc3 *dwc)
1340 {
1341 struct device *dev = dwc->dev;
1342 struct device_node *node = dev->of_node;
1343 char phy_name[11];
1344 int ret;
1345 int i;
1346
1347 if (node) {
1348 dwc->usb2_phy = devm_usb_get_phy_by_phandle(dev, "usb-phy", 0);
1349 dwc->usb3_phy = devm_usb_get_phy_by_phandle(dev, "usb-phy", 1);
1350 } else {
1351 dwc->usb2_phy = devm_usb_get_phy(dev, USB_PHY_TYPE_USB2);
1352 dwc->usb3_phy = devm_usb_get_phy(dev, USB_PHY_TYPE_USB3);
1353 }
1354
1355 if (IS_ERR(dwc->usb2_phy)) {
1356 ret = PTR_ERR(dwc->usb2_phy);
1357 if (ret == -ENXIO || ret == -ENODEV)
1358 dwc->usb2_phy = NULL;
1359 else
1360 return dev_err_probe(dev, ret, "no usb2 phy configured\n");
1361 }
1362
1363 if (IS_ERR(dwc->usb3_phy)) {
1364 ret = PTR_ERR(dwc->usb3_phy);
1365 if (ret == -ENXIO || ret == -ENODEV)
1366 dwc->usb3_phy = NULL;
1367 else
1368 return dev_err_probe(dev, ret, "no usb3 phy configured\n");
1369 }
1370
1371 for (i = 0; i < dwc->num_usb2_ports; i++) {
1372 if (dwc->num_usb2_ports == 1)
1373 sprintf(phy_name, "usb2-phy");
1374 else
> 1375 sprintf(phy_name, "usb2-port%d", i);
1376
1377 dwc->usb2_generic_phy[i] = devm_phy_get(dev, phy_name);
1378 if (IS_ERR(dwc->usb2_generic_phy[i])) {
1379 ret = PTR_ERR(dwc->usb2_generic_phy[i]);
1380 if (ret == -ENOSYS || ret == -ENODEV)
1381 dwc->usb2_generic_phy[i] = NULL;
1382 else
1383 return dev_err_probe(dev, ret,
1384 "failed to lookup phy %s\n", phy_name);
1385 }
1386
1387 if (dwc->num_usb2_ports == 1)
1388 sprintf(phy_name, "usb3-phy");
1389 else
1390 sprintf(phy_name, "usb3-port%d", i);
1391
1392 dwc->usb3_generic_phy[i] = devm_phy_get(dev, phy_name);
1393 if (IS_ERR(dwc->usb3_generic_phy[i])) {
1394 ret = PTR_ERR(dwc->usb3_generic_phy[i]);
1395 if (ret == -ENOSYS || ret == -ENODEV)
1396 dwc->usb3_generic_phy[i] = NULL;
1397 else
1398 return dev_err_probe(dev, ret,
1399 "failed to lookup phy %s\n", phy_name);
1400 }
1401 }
1402
1403 return 0;
1404 }
1405

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki