All of lore.kernel.org
 help / color / mirror / Atom feed
* [linux-next:master 9403/12137] drivers/net/ethernet/airoha/airoha_eth.c:3470:25: sparse: sparse: division by zero
@ 2026-08-04  1:08 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2026-08-04  1:08 UTC (permalink / raw)
  To: oe-kbuild; +Cc: lkp

:::::: 
:::::: Manual check reason: "low confidence static check warning: drivers/net/ethernet/airoha/airoha_eth.c:3470:25: sparse: sparse: division by zero"
:::::: 

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
TO: Lorenzo Bianconi <lorenzo@kernel.org>
CC: Paolo Abeni <pabeni@redhat.com>
CC: Alexander Lobakin <aleksander.lobakin@intel.com>
CC: Simon Horman <horms@kernel.org>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   9a4cdc958dd79fc6c3b20b51a10debec6ca09fec
commit: 78a35725e533eef0afe83f6f96cffd69be9eaac7 [9403/12137] net: airoha: defer GDM3/GDM4 WAN mode and GDM2 loopback to QoS offload
:::::: branch date: 8 hours ago
:::::: commit date: 5 days ago
config: arm-randconfig-r121-20260803 (https://download.01.org/0day-ci/archive/20260804/202608040800.45L57Mym-lkp@intel.com/config)
compiler: arm-linux-gnueabi-gcc (GCC) 15.2.0
sparse: v0.6.5-rc1
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260804/202608040800.45L57Mym-lkp@intel.com/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@intel.com>
| Closes: https://lore.kernel.org/r/202608040800.45L57Mym-lkp@intel.com/

sparse warnings: (new ones prefixed by >>)
   drivers/net/ethernet/airoha/airoha_eth.c: note: in included file (through include/linux/if_ether.h, include/linux/ethtool.h, include/linux/phy.h, include/linux/of_net.h):
   include/linux/skbuff.h:2904:28: sparse: sparse: unsigned value that used to be signed checked against zero?
   include/linux/skbuff.h:2904:28: sparse: signed value source
   include/linux/skbuff.h:2904:28: sparse: sparse: unsigned value that used to be signed checked against zero?
   include/linux/skbuff.h:2904:28: sparse: signed value source
>> drivers/net/ethernet/airoha/airoha_eth.c:3470:25: sparse: sparse: division by zero

vim +3470 drivers/net/ethernet/airoha/airoha_eth.c

09bccf56db36501 Lorenzo Bianconi 2025-04-01  3411  
ec6c391bcca748b Lorenzo Bianconi 2026-05-27  3412  static int airoha_alloc_gdm_device(struct airoha_eth *eth,
ec6c391bcca748b Lorenzo Bianconi 2026-05-27  3413  				   struct airoha_gdm_port *port,
a9c2ca61fec7706 Lorenzo Bianconi 2026-06-03  3414  				   int nbq, struct device_node *np)
ec6c391bcca748b Lorenzo Bianconi 2026-05-27  3415  {
ec6c391bcca748b Lorenzo Bianconi 2026-05-27  3416  	struct net_device *netdev;
a9c2ca61fec7706 Lorenzo Bianconi 2026-06-03  3417  	struct airoha_gdm_dev *dev;
78a35725e533eef Lorenzo Bianconi 2026-07-25  3418  	int err, i;
a9c2ca61fec7706 Lorenzo Bianconi 2026-06-03  3419  	u8 index;
ec6c391bcca748b Lorenzo Bianconi 2026-05-27  3420  
ec6c391bcca748b Lorenzo Bianconi 2026-05-27  3421  	netdev = devm_alloc_etherdev_mqs(eth->dev, sizeof(*dev),
ec6c391bcca748b Lorenzo Bianconi 2026-05-27  3422  					 AIROHA_NUM_NETDEV_TX_RINGS,
ec6c391bcca748b Lorenzo Bianconi 2026-05-27  3423  					 AIROHA_NUM_RX_RING);
ec6c391bcca748b Lorenzo Bianconi 2026-05-27  3424  	if (!netdev) {
ec6c391bcca748b Lorenzo Bianconi 2026-05-27  3425  		dev_err(eth->dev, "alloc_etherdev failed\n");
ec6c391bcca748b Lorenzo Bianconi 2026-05-27  3426  		return -ENOMEM;
ec6c391bcca748b Lorenzo Bianconi 2026-05-27  3427  	}
ec6c391bcca748b Lorenzo Bianconi 2026-05-27  3428  
ec6c391bcca748b Lorenzo Bianconi 2026-05-27  3429  	netdev->netdev_ops = &airoha_netdev_ops;
ec6c391bcca748b Lorenzo Bianconi 2026-05-27  3430  	netdev->ethtool_ops = &airoha_ethtool_ops;
ec6c391bcca748b Lorenzo Bianconi 2026-05-27  3431  	netdev->max_mtu = AIROHA_MAX_MTU;
ec6c391bcca748b Lorenzo Bianconi 2026-05-27  3432  	netdev->watchdog_timeo = 5 * HZ;
ec6c391bcca748b Lorenzo Bianconi 2026-05-27  3433  	netdev->hw_features = NETIF_F_IP_CSUM | NETIF_F_RXCSUM | NETIF_F_TSO6 |
ec6c391bcca748b Lorenzo Bianconi 2026-05-27  3434  			      NETIF_F_IPV6_CSUM | NETIF_F_SG | NETIF_F_TSO |
ec6c391bcca748b Lorenzo Bianconi 2026-05-27  3435  			      NETIF_F_HW_TC;
ec6c391bcca748b Lorenzo Bianconi 2026-05-27  3436  	netdev->features |= netdev->hw_features;
ec6c391bcca748b Lorenzo Bianconi 2026-05-27  3437  	netdev->vlan_features = netdev->hw_features;
ec6c391bcca748b Lorenzo Bianconi 2026-05-27  3438  	SET_NETDEV_DEV(netdev, eth->dev);
ec6c391bcca748b Lorenzo Bianconi 2026-05-27  3439  
ec6c391bcca748b Lorenzo Bianconi 2026-05-27  3440  	/* reserve hw queues for HTB offloading */
ec6c391bcca748b Lorenzo Bianconi 2026-05-27  3441  	err = netif_set_real_num_tx_queues(netdev, AIROHA_NUM_TX_RING);
ec6c391bcca748b Lorenzo Bianconi 2026-05-27  3442  	if (err)
ec6c391bcca748b Lorenzo Bianconi 2026-05-27  3443  		return err;
ec6c391bcca748b Lorenzo Bianconi 2026-05-27  3444  
ec6c391bcca748b Lorenzo Bianconi 2026-05-27  3445  	err = of_get_ethdev_address(np, netdev);
ec6c391bcca748b Lorenzo Bianconi 2026-05-27  3446  	if (err) {
ec6c391bcca748b Lorenzo Bianconi 2026-05-27  3447  		if (err == -EPROBE_DEFER)
ec6c391bcca748b Lorenzo Bianconi 2026-05-27  3448  			return err;
ec6c391bcca748b Lorenzo Bianconi 2026-05-27  3449  
ec6c391bcca748b Lorenzo Bianconi 2026-05-27  3450  		eth_hw_addr_random(netdev);
ec6c391bcca748b Lorenzo Bianconi 2026-05-27  3451  		dev_info(eth->dev, "generated random MAC address %pM\n",
ec6c391bcca748b Lorenzo Bianconi 2026-05-27  3452  			 netdev->dev_addr);
ec6c391bcca748b Lorenzo Bianconi 2026-05-27  3453  	}
ec6c391bcca748b Lorenzo Bianconi 2026-05-27  3454  
a9c2ca61fec7706 Lorenzo Bianconi 2026-06-03  3455  	/* Allowed nbq for EN7581 on GDM3 port are 4 and 5 for PCIE0
a9c2ca61fec7706 Lorenzo Bianconi 2026-06-03  3456  	 * and PCIE1 respectively.
a9c2ca61fec7706 Lorenzo Bianconi 2026-06-03  3457  	 */
a9c2ca61fec7706 Lorenzo Bianconi 2026-06-03  3458  	index = nbq;
a9c2ca61fec7706 Lorenzo Bianconi 2026-06-03  3459  	if (index && airoha_is_7581(eth) && port->id == AIROHA_GDM3_IDX)
a9c2ca61fec7706 Lorenzo Bianconi 2026-06-03  3460  		index -= 4;
a9c2ca61fec7706 Lorenzo Bianconi 2026-06-03  3461  
a9c2ca61fec7706 Lorenzo Bianconi 2026-06-03  3462  	if (index >= ARRAY_SIZE(port->devs) || port->devs[index]) {
a9c2ca61fec7706 Lorenzo Bianconi 2026-06-03  3463  		dev_err(eth->dev, "invalid nbq id: %d\n", nbq);
a9c2ca61fec7706 Lorenzo Bianconi 2026-06-03  3464  		return -EINVAL;
a9c2ca61fec7706 Lorenzo Bianconi 2026-06-03  3465  	}
a9c2ca61fec7706 Lorenzo Bianconi 2026-06-03  3466  
a9c2ca61fec7706 Lorenzo Bianconi 2026-06-03  3467  	netdev->dev.of_node = of_node_get(np);
ec6c391bcca748b Lorenzo Bianconi 2026-05-27  3468  	dev = netdev_priv(netdev);
8f4695fb67b259b Lorenzo Bianconi 2026-06-11  3469  	u64_stats_init(&dev->stats.syncp);
78a35725e533eef Lorenzo Bianconi 2026-07-25 @3470  	for (i = 0; i < ARRAY_SIZE(dev->txq_lock); i++)
78a35725e533eef Lorenzo Bianconi 2026-07-25  3471  		spin_lock_init(&dev->txq_lock[i]);
ec6c391bcca748b Lorenzo Bianconi 2026-05-27  3472  	dev->port = port;
ec6c391bcca748b Lorenzo Bianconi 2026-05-27  3473  	dev->eth = eth;
a9c2ca61fec7706 Lorenzo Bianconi 2026-06-03  3474  	dev->nbq = nbq;
a9c2ca61fec7706 Lorenzo Bianconi 2026-06-03  3475  	port->devs[index] = dev;
ec6c391bcca748b Lorenzo Bianconi 2026-05-27  3476  
ec6c391bcca748b Lorenzo Bianconi 2026-05-27  3477  	return 0;
ec6c391bcca748b Lorenzo Bianconi 2026-05-27  3478  }
ec6c391bcca748b Lorenzo Bianconi 2026-05-27  3479  

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-08-04  1:08 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-04  1:08 [linux-next:master 9403/12137] drivers/net/ethernet/airoha/airoha_eth.c:3470:25: sparse: sparse: division by zero kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.