[PATCH net-next] net: use pdev instead of OF funcs

kernel test robot lkp at intel.com
Sun Nov 10 23:37:06 AEDT 2024


Hi Rosen,

kernel test robot noticed the following build warnings:

[auto build test WARNING on net-next/main]

url:    https://github.com/intel-lab-lkp/linux/commits/Rosen-Penev/net-use-pdev-instead-of-OF-funcs/20241110-073939
base:   net-next/main
patch link:    https://lore.kernel.org/r/20241109233821.8619-1-rosenp%40gmail.com
patch subject: [PATCH net-next] net: use pdev instead of OF funcs
config: arm-moxart_defconfig (https://download.01.org/0day-ci/archive/20241110/202411102000.aEYCgzAp-lkp@intel.com/config)
compiler: arm-linux-gnueabi-gcc (GCC) 13.3.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241110/202411102000.aEYCgzAp-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 at intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202411102000.aEYCgzAp-lkp@intel.com/

All warnings (new ones prefixed by >>):

   drivers/net/ethernet/moxa/moxart_ether.c: In function 'moxart_mac_probe':
>> drivers/net/ethernet/moxa/moxart_ether.c:457:29: warning: unused variable 'node' [-Wunused-variable]
     457 |         struct device_node *node = p_dev->of_node;
         |                             ^~~~


vim +/node +457 drivers/net/ethernet/moxa/moxart_ether.c

6c821bd9edc956 Jonas Jensen      2013-08-08  453  
6c821bd9edc956 Jonas Jensen      2013-08-08  454  static int moxart_mac_probe(struct platform_device *pdev)
6c821bd9edc956 Jonas Jensen      2013-08-08  455  {
6c821bd9edc956 Jonas Jensen      2013-08-08  456  	struct device *p_dev = &pdev->dev;
6c821bd9edc956 Jonas Jensen      2013-08-08 @457  	struct device_node *node = p_dev->of_node;
6c821bd9edc956 Jonas Jensen      2013-08-08  458  	struct net_device *ndev;
6c821bd9edc956 Jonas Jensen      2013-08-08  459  	struct moxart_mac_priv_t *priv;
6c821bd9edc956 Jonas Jensen      2013-08-08  460  	struct resource *res;
6c821bd9edc956 Jonas Jensen      2013-08-08  461  	unsigned int irq;
6c821bd9edc956 Jonas Jensen      2013-08-08  462  	int ret;
6c821bd9edc956 Jonas Jensen      2013-08-08  463  
6c821bd9edc956 Jonas Jensen      2013-08-08  464  	ndev = alloc_etherdev(sizeof(struct moxart_mac_priv_t));
6c821bd9edc956 Jonas Jensen      2013-08-08  465  	if (!ndev)
6c821bd9edc956 Jonas Jensen      2013-08-08  466  		return -ENOMEM;
6c821bd9edc956 Jonas Jensen      2013-08-08  467  
c22f4680de3d5a Rosen Penev       2024-11-09  468  	irq = platform_get_irq(pdev, 0);
6c821bd9edc956 Jonas Jensen      2013-08-08  469  	if (irq <= 0) {
c22f4680de3d5a Rosen Penev       2024-11-09  470  		netdev_err(ndev, "platform_get_irq failed\n");
bdfd6304c8e243 Wei Yongjun       2013-10-08  471  		ret = -EINVAL;
bdfd6304c8e243 Wei Yongjun       2013-10-08  472  		goto irq_map_fail;
6c821bd9edc956 Jonas Jensen      2013-08-08  473  	}
6c821bd9edc956 Jonas Jensen      2013-08-08  474  
6c821bd9edc956 Jonas Jensen      2013-08-08  475  	priv = netdev_priv(ndev);
6c821bd9edc956 Jonas Jensen      2013-08-08  476  	priv->ndev = ndev;
5dac33ad6f0d1d Christoph Hellwig 2019-02-11  477  	priv->pdev = pdev;
6c821bd9edc956 Jonas Jensen      2013-08-08  478  
35cba15a504bf4 Yang Yingliang    2021-06-07  479  	priv->base = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
1d3cd1773fddfd Dan Carpenter     2016-03-02  480  	if (IS_ERR(priv->base)) {
1d3cd1773fddfd Dan Carpenter     2016-03-02  481  		ret = PTR_ERR(priv->base);
6c821bd9edc956 Jonas Jensen      2013-08-08  482  		goto init_fail;
6c821bd9edc956 Jonas Jensen      2013-08-08  483  	}
35cba15a504bf4 Yang Yingliang    2021-06-07  484  	ndev->base_addr = res->start;
6c821bd9edc956 Jonas Jensen      2013-08-08  485  
f4693b81ea3802 Sergei Antonov    2022-08-18  486  	ret = platform_get_ethdev_address(p_dev, ndev);
f4693b81ea3802 Sergei Antonov    2022-08-18  487  	if (ret == -EPROBE_DEFER)
f4693b81ea3802 Sergei Antonov    2022-08-18  488  		goto init_fail;
f4693b81ea3802 Sergei Antonov    2022-08-18  489  	if (ret)
f4693b81ea3802 Sergei Antonov    2022-08-18  490  		eth_hw_addr_random(ndev);
f4693b81ea3802 Sergei Antonov    2022-08-18  491  	moxart_update_mac_address(ndev);
f4693b81ea3802 Sergei Antonov    2022-08-18  492  
6c821bd9edc956 Jonas Jensen      2013-08-08  493  	spin_lock_init(&priv->txlock);
6c821bd9edc956 Jonas Jensen      2013-08-08  494  
6c821bd9edc956 Jonas Jensen      2013-08-08  495  	priv->tx_buf_size = TX_BUF_SIZE;
9fe1b3bc8d9182 Jonas Jensen      2014-08-25  496  	priv->rx_buf_size = RX_BUF_SIZE;
6c821bd9edc956 Jonas Jensen      2013-08-08  497  
3a12df22a8f689 Sergei Antonov    2022-08-12  498  	priv->tx_desc_base = dma_alloc_coherent(p_dev, TX_REG_DESC_SIZE *
6c821bd9edc956 Jonas Jensen      2013-08-08  499  						TX_DESC_NUM, &priv->tx_base,
6c821bd9edc956 Jonas Jensen      2013-08-08  500  						GFP_DMA | GFP_KERNEL);
e8048b84bbfd3e SZ Lin            2017-07-29  501  	if (!priv->tx_desc_base) {
bdfd6304c8e243 Wei Yongjun       2013-10-08  502  		ret = -ENOMEM;
6c821bd9edc956 Jonas Jensen      2013-08-08  503  		goto init_fail;
bdfd6304c8e243 Wei Yongjun       2013-10-08  504  	}
6c821bd9edc956 Jonas Jensen      2013-08-08  505  
3a12df22a8f689 Sergei Antonov    2022-08-12  506  	priv->rx_desc_base = dma_alloc_coherent(p_dev, RX_REG_DESC_SIZE *
6c821bd9edc956 Jonas Jensen      2013-08-08  507  						RX_DESC_NUM, &priv->rx_base,
6c821bd9edc956 Jonas Jensen      2013-08-08  508  						GFP_DMA | GFP_KERNEL);
e8048b84bbfd3e SZ Lin            2017-07-29  509  	if (!priv->rx_desc_base) {
bdfd6304c8e243 Wei Yongjun       2013-10-08  510  		ret = -ENOMEM;
6c821bd9edc956 Jonas Jensen      2013-08-08  511  		goto init_fail;
bdfd6304c8e243 Wei Yongjun       2013-10-08  512  	}
6c821bd9edc956 Jonas Jensen      2013-08-08  513  
6da2ec56059c3c Kees Cook         2018-06-12  514  	priv->tx_buf_base = kmalloc_array(priv->tx_buf_size, TX_DESC_NUM,
c9ac080b25d98d Julia Lawall      2022-02-10  515  					  GFP_KERNEL);
bdfd6304c8e243 Wei Yongjun       2013-10-08  516  	if (!priv->tx_buf_base) {
bdfd6304c8e243 Wei Yongjun       2013-10-08  517  		ret = -ENOMEM;
6c821bd9edc956 Jonas Jensen      2013-08-08  518  		goto init_fail;
bdfd6304c8e243 Wei Yongjun       2013-10-08  519  	}
6c821bd9edc956 Jonas Jensen      2013-08-08  520  
6da2ec56059c3c Kees Cook         2018-06-12  521  	priv->rx_buf_base = kmalloc_array(priv->rx_buf_size, RX_DESC_NUM,
c9ac080b25d98d Julia Lawall      2022-02-10  522  					  GFP_KERNEL);
bdfd6304c8e243 Wei Yongjun       2013-10-08  523  	if (!priv->rx_buf_base) {
bdfd6304c8e243 Wei Yongjun       2013-10-08  524  		ret = -ENOMEM;
6c821bd9edc956 Jonas Jensen      2013-08-08  525  		goto init_fail;
bdfd6304c8e243 Wei Yongjun       2013-10-08  526  	}
6c821bd9edc956 Jonas Jensen      2013-08-08  527  
6c821bd9edc956 Jonas Jensen      2013-08-08  528  	platform_set_drvdata(pdev, ndev);
6c821bd9edc956 Jonas Jensen      2013-08-08  529  
6c821bd9edc956 Jonas Jensen      2013-08-08  530  	ret = devm_request_irq(p_dev, irq, moxart_mac_interrupt, 0,
6c821bd9edc956 Jonas Jensen      2013-08-08  531  			       pdev->name, ndev);
6c821bd9edc956 Jonas Jensen      2013-08-08  532  	if (ret) {
6c821bd9edc956 Jonas Jensen      2013-08-08  533  		netdev_err(ndev, "devm_request_irq failed\n");
6c821bd9edc956 Jonas Jensen      2013-08-08  534  		goto init_fail;
6c821bd9edc956 Jonas Jensen      2013-08-08  535  	}
6c821bd9edc956 Jonas Jensen      2013-08-08  536  
6c821bd9edc956 Jonas Jensen      2013-08-08  537  	ndev->netdev_ops = &moxart_netdev_ops;
b707b89f7be361 Jakub Kicinski    2022-05-06  538  	netif_napi_add_weight(ndev, &priv->napi, moxart_rx_poll, RX_DESC_NUM);
6c821bd9edc956 Jonas Jensen      2013-08-08  539  	ndev->priv_flags |= IFF_UNICAST_FLT;
6c821bd9edc956 Jonas Jensen      2013-08-08  540  	ndev->irq = irq;
6c821bd9edc956 Jonas Jensen      2013-08-08  541  
6c821bd9edc956 Jonas Jensen      2013-08-08  542  	SET_NETDEV_DEV(ndev, &pdev->dev);
6c821bd9edc956 Jonas Jensen      2013-08-08  543  
6c821bd9edc956 Jonas Jensen      2013-08-08  544  	ret = register_netdev(ndev);
c78eaeebe855fd Pavel Skripkin    2021-07-09  545  	if (ret)
6c821bd9edc956 Jonas Jensen      2013-08-08  546  		goto init_fail;
6c821bd9edc956 Jonas Jensen      2013-08-08  547  
6c821bd9edc956 Jonas Jensen      2013-08-08  548  	netdev_dbg(ndev, "%s: IRQ=%d address=%pM\n",
6c821bd9edc956 Jonas Jensen      2013-08-08  549  		   __func__, ndev->irq, ndev->dev_addr);
6c821bd9edc956 Jonas Jensen      2013-08-08  550  
6c821bd9edc956 Jonas Jensen      2013-08-08  551  	return 0;
6c821bd9edc956 Jonas Jensen      2013-08-08  552  
6c821bd9edc956 Jonas Jensen      2013-08-08  553  init_fail:
6c821bd9edc956 Jonas Jensen      2013-08-08  554  	netdev_err(ndev, "init failed\n");
6c821bd9edc956 Jonas Jensen      2013-08-08  555  	moxart_mac_free_memory(ndev);
bdfd6304c8e243 Wei Yongjun       2013-10-08  556  irq_map_fail:
bdfd6304c8e243 Wei Yongjun       2013-10-08  557  	free_netdev(ndev);
6c821bd9edc956 Jonas Jensen      2013-08-08  558  	return ret;
6c821bd9edc956 Jonas Jensen      2013-08-08  559  }
6c821bd9edc956 Jonas Jensen      2013-08-08  560  

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


More information about the Linuxppc-dev mailing list