Re: [PATCH v3] usb: gadget: f_ncm: Fix MAC assignment NCM ethernet

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

 



Hi raub,

kernel test robot noticed the following build errors:

[auto build test ERROR on usb/usb-testing]
[also build test ERROR on usb/usb-next usb/usb-linus westeri-thunderbolt/next linus/master v6.17-rc1 next-20250814]
[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/raub-camaioni/usb-gadget-f_ncm-Fix-MAC-assignment-NCM-ethernet/20250815-011301
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
patch link:    https://lore.kernel.org/r/20250814171125.635429-1-raubcameo%40gmail.com
patch subject: [PATCH v3] usb: gadget: f_ncm: Fix MAC assignment NCM ethernet
config: i386-randconfig-011-20250815 (https://download.01.org/0day-ci/archive/20250815/202508151101.dzCtG6Wh-lkp@xxxxxxxxx/config)
compiler: gcc-12 (Debian 12.2.0-14+deb12u1) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250815/202508151101.dzCtG6Wh-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/202508151101.dzCtG6Wh-lkp@xxxxxxxxx/

All errors (new ones prefixed by >>):

   drivers/usb/gadget/function/f_ncm.c: In function 'ncm_bind':
>> drivers/usb/gadget/function/f_ncm.c:1466:32: error: 'ecm' undeclared (first use in this function); did you mean 'ncm'?
    1466 |         ncm_string_defs[1].s = ecm->ethaddr;
         |                                ^~~
         |                                ncm
   drivers/usb/gadget/function/f_ncm.c:1466:32: note: each undeclared identifier is reported only once for each function it appears in


vim +1466 drivers/usb/gadget/function/f_ncm.c

  1429	
  1430	static int ncm_bind(struct usb_configuration *c, struct usb_function *f)
  1431	{
  1432		struct usb_composite_dev *cdev = c->cdev;
  1433		struct f_ncm		*ncm = func_to_ncm(f);
  1434		struct usb_string	*us;
  1435		int			status = 0;
  1436		struct usb_ep		*ep;
  1437		struct f_ncm_opts	*ncm_opts;
  1438	
  1439		if (!can_support_ecm(cdev->gadget))
  1440			return -EINVAL;
  1441	
  1442		ncm_opts = container_of(f->fi, struct f_ncm_opts, func_inst);
  1443	
  1444		if (cdev->use_os_string) {
  1445			f->os_desc_table = kzalloc(sizeof(*f->os_desc_table),
  1446						   GFP_KERNEL);
  1447			if (!f->os_desc_table)
  1448				return -ENOMEM;
  1449			f->os_desc_n = 1;
  1450			f->os_desc_table[0].os_desc = &ncm_opts->ncm_os_desc;
  1451		}
  1452	
  1453		mutex_lock(&ncm_opts->lock);
  1454		gether_set_gadget(ncm_opts->net, cdev->gadget);
  1455		if (!ncm_opts->bound) {
  1456			ncm_opts->net->mtu = (ncm_opts->max_segment_size - ETH_HLEN);
  1457			status = gether_register_netdev(ncm_opts->net);
  1458		}
  1459		mutex_unlock(&ncm_opts->lock);
  1460	
  1461		if (status)
  1462			goto fail;
  1463	
  1464		ncm_opts->bound = true;
  1465	
> 1466		ncm_string_defs[1].s = ecm->ethaddr;
  1467	
  1468		us = usb_gstrings_attach(cdev, ncm_strings,
  1469					 ARRAY_SIZE(ncm_string_defs));
  1470		if (IS_ERR(us)) {
  1471			status = PTR_ERR(us);
  1472			goto fail;
  1473		}
  1474		ncm_control_intf.iInterface = us[STRING_CTRL_IDX].id;
  1475		ncm_data_nop_intf.iInterface = us[STRING_DATA_IDX].id;
  1476		ncm_data_intf.iInterface = us[STRING_DATA_IDX].id;
  1477		ecm_desc.iMACAddress = us[STRING_MAC_IDX].id;
  1478		ncm_iad_desc.iFunction = us[STRING_IAD_IDX].id;
  1479	
  1480		/* allocate instance-specific interface IDs */
  1481		status = usb_interface_id(c, f);
  1482		if (status < 0)
  1483			goto fail;
  1484		ncm->ctrl_id = status;
  1485		ncm_iad_desc.bFirstInterface = status;
  1486	
  1487		ncm_control_intf.bInterfaceNumber = status;
  1488		ncm_union_desc.bMasterInterface0 = status;
  1489	
  1490		if (cdev->use_os_string)
  1491			f->os_desc_table[0].if_id =
  1492				ncm_iad_desc.bFirstInterface;
  1493	
  1494		status = usb_interface_id(c, f);
  1495		if (status < 0)
  1496			goto fail;
  1497		ncm->data_id = status;
  1498	
  1499		ncm_data_nop_intf.bInterfaceNumber = status;
  1500		ncm_data_intf.bInterfaceNumber = status;
  1501		ncm_union_desc.bSlaveInterface0 = status;
  1502	
  1503		ecm_desc.wMaxSegmentSize = cpu_to_le16(ncm_opts->max_segment_size);
  1504	
  1505		status = -ENODEV;
  1506	
  1507		/* allocate instance-specific endpoints */
  1508		ep = usb_ep_autoconfig(cdev->gadget, &fs_ncm_in_desc);
  1509		if (!ep)
  1510			goto fail;
  1511		ncm->port.in_ep = ep;
  1512	
  1513		ep = usb_ep_autoconfig(cdev->gadget, &fs_ncm_out_desc);
  1514		if (!ep)
  1515			goto fail;
  1516		ncm->port.out_ep = ep;
  1517	
  1518		ep = usb_ep_autoconfig(cdev->gadget, &fs_ncm_notify_desc);
  1519		if (!ep)
  1520			goto fail;
  1521		ncm->notify = ep;
  1522	
  1523		status = -ENOMEM;
  1524	
  1525		/* allocate notification request and buffer */
  1526		ncm->notify_req = usb_ep_alloc_request(ep, GFP_KERNEL);
  1527		if (!ncm->notify_req)
  1528			goto fail;
  1529		ncm->notify_req->buf = kmalloc(NCM_STATUS_BYTECOUNT, GFP_KERNEL);
  1530		if (!ncm->notify_req->buf)
  1531			goto fail;
  1532		ncm->notify_req->context = ncm;
  1533		ncm->notify_req->complete = ncm_notify_complete;
  1534	
  1535		/*
  1536		 * support all relevant hardware speeds... we expect that when
  1537		 * hardware is dual speed, all bulk-capable endpoints work at
  1538		 * both speeds
  1539		 */
  1540		hs_ncm_in_desc.bEndpointAddress = fs_ncm_in_desc.bEndpointAddress;
  1541		hs_ncm_out_desc.bEndpointAddress = fs_ncm_out_desc.bEndpointAddress;
  1542		hs_ncm_notify_desc.bEndpointAddress =
  1543			fs_ncm_notify_desc.bEndpointAddress;
  1544	
  1545		ss_ncm_in_desc.bEndpointAddress = fs_ncm_in_desc.bEndpointAddress;
  1546		ss_ncm_out_desc.bEndpointAddress = fs_ncm_out_desc.bEndpointAddress;
  1547		ss_ncm_notify_desc.bEndpointAddress =
  1548			fs_ncm_notify_desc.bEndpointAddress;
  1549	
  1550		status = usb_assign_descriptors(f, ncm_fs_function, ncm_hs_function,
  1551				ncm_ss_function, ncm_ss_function);
  1552		if (status)
  1553			goto fail;
  1554	
  1555		/*
  1556		 * NOTE:  all that is done without knowing or caring about
  1557		 * the network link ... which is unavailable to this code
  1558		 * until we're activated via set_alt().
  1559		 */
  1560	
  1561		ncm->port.open = ncm_open;
  1562		ncm->port.close = ncm_close;
  1563	
  1564		hrtimer_setup(&ncm->task_timer, ncm_tx_timeout, CLOCK_MONOTONIC, HRTIMER_MODE_REL_SOFT);
  1565	
  1566		DBG(cdev, "CDC Network: IN/%s OUT/%s NOTIFY/%s\n",
  1567				ncm->port.in_ep->name, ncm->port.out_ep->name,
  1568				ncm->notify->name);
  1569		return 0;
  1570	
  1571	fail:
  1572		kfree(f->os_desc_table);
  1573		f->os_desc_n = 0;
  1574	
  1575		if (ncm->notify_req) {
  1576			kfree(ncm->notify_req->buf);
  1577			usb_ep_free_request(ncm->notify, ncm->notify_req);
  1578		}
  1579	
  1580		ERROR(cdev, "%s: can't bind, err %d\n", f->name, status);
  1581	
  1582		return status;
  1583	}
  1584	

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




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux