drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:1647 init_dma_rx_desc_rings() warn: always true condition '(queue >= 0) => (0-u32max >= 0)'
From: kernel test robot
Date: Thu Nov 18 2021 - 17:58:35 EST
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 6fdf886424cf8c4fff96a20189c00606327e5df6
commit: de0b90e52a116a951ca8b13c924c359d5fc39fa0 net: stmmac: rearrange RX and TX desc init into per-queue basis
date: 7 months ago
config: arm-randconfig-m031-20211116 (attached as .config)
compiler: arm-linux-gnueabi-gcc (GCC) 11.2.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>
New smatch warnings:
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:1647 init_dma_rx_desc_rings() warn: always true condition '(queue >= 0) => (0-u32max >= 0)'
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:1647 init_dma_rx_desc_rings() warn: always true condition '(queue >= 0) => (0-u32max >= 0)'
Old smatch warnings:
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:1567 stmmac_reinit_rx_buffers() warn: always true condition '(queue >= 0) => (0-u32max >= 0)'
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:1567 stmmac_reinit_rx_buffers() warn: always true condition '(queue >= 0) => (0-u32max >= 0)'
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c:4453 stmmac_xdp_run_prog() error: (-2147483647) too low for ERR_PTR
vim +1647 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
de0b90e52a116a9 Ong Boon Leong 2021-04-13 1626
de0b90e52a116a9 Ong Boon Leong 2021-04-13 1627 static int init_dma_rx_desc_rings(struct net_device *dev, gfp_t flags)
de0b90e52a116a9 Ong Boon Leong 2021-04-13 1628 {
de0b90e52a116a9 Ong Boon Leong 2021-04-13 1629 struct stmmac_priv *priv = netdev_priv(dev);
de0b90e52a116a9 Ong Boon Leong 2021-04-13 1630 u32 rx_count = priv->plat->rx_queues_to_use;
de0b90e52a116a9 Ong Boon Leong 2021-04-13 1631 u32 queue;
de0b90e52a116a9 Ong Boon Leong 2021-04-13 1632 int ret;
de0b90e52a116a9 Ong Boon Leong 2021-04-13 1633
de0b90e52a116a9 Ong Boon Leong 2021-04-13 1634 /* RX INITIALIZATION */
de0b90e52a116a9 Ong Boon Leong 2021-04-13 1635 netif_dbg(priv, probe, priv->dev,
de0b90e52a116a9 Ong Boon Leong 2021-04-13 1636 "SKB addresses:\nskb\t\tskb data\tdma data\n");
de0b90e52a116a9 Ong Boon Leong 2021-04-13 1637
de0b90e52a116a9 Ong Boon Leong 2021-04-13 1638 for (queue = 0; queue < rx_count; queue++) {
de0b90e52a116a9 Ong Boon Leong 2021-04-13 1639 ret = __init_dma_rx_desc_rings(priv, queue, flags);
de0b90e52a116a9 Ong Boon Leong 2021-04-13 1640 if (ret)
de0b90e52a116a9 Ong Boon Leong 2021-04-13 1641 goto err_init_rx_buffers;
54139cf3bb33fad Joao Pinto 2017-04-06 1642 }
54139cf3bb33fad Joao Pinto 2017-04-06 1643
71fedb0198cbbda Joao Pinto 2017-04-06 1644 return 0;
54139cf3bb33fad Joao Pinto 2017-04-06 1645
71fedb0198cbbda Joao Pinto 2017-04-06 1646 err_init_rx_buffers:
54139cf3bb33fad Joao Pinto 2017-04-06 @1647 while (queue >= 0) {
4298255f26fa91c Ong Boon Leong 2021-04-13 1648 dma_free_rx_skbufs(priv, queue);
54139cf3bb33fad Joao Pinto 2017-04-06 1649
54139cf3bb33fad Joao Pinto 2017-04-06 1650 if (queue == 0)
54139cf3bb33fad Joao Pinto 2017-04-06 1651 break;
54139cf3bb33fad Joao Pinto 2017-04-06 1652
54139cf3bb33fad Joao Pinto 2017-04-06 1653 queue--;
54139cf3bb33fad Joao Pinto 2017-04-06 1654 }
54139cf3bb33fad Joao Pinto 2017-04-06 1655
71fedb0198cbbda Joao Pinto 2017-04-06 1656 return ret;
71fedb0198cbbda Joao Pinto 2017-04-06 1657 }
71fedb0198cbbda Joao Pinto 2017-04-06 1658
:::::: The code at line 1647 was first introduced by commit
:::::: 54139cf3bb33fad075737000f22749cafe3e83a0 net: stmmac: adding multiple buffers for rx
:::::: TO: Joao Pinto <Joao.Pinto@xxxxxxxxxxxx>
:::::: CC: David S. Miller <davem@xxxxxxxxxxxxx>
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx
Attachment:
.config.gz
Description: application/gzip