Re: [PATCH] net: marvell: Use min() instead of doing it manually

From: kernel test robot
Date: Tue Mar 01 2022 - 05:30:24 EST


Hi Haowen,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on net-next/master]
[also build test WARNING on net/master horms-ipvs/master linus/master v5.17-rc6 next-20220228]
[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]

url: https://github.com/0day-ci/linux/commits/Haowen-Bai/net-marvell-Use-min-instead-of-doing-it-manually/20220301-141800
base: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git f2b77012ddd5b2532d262f100be3394ceae3ea59
config: hexagon-randconfig-r041-20220301 (https://download.01.org/0day-ci/archive/20220301/202203011855.FRrOViok-lkp@xxxxxxxxx/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project d271fc04d5b97b12e6b797c6067d3c96a8d7470e)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/55e43d9d6e3e0a8774e6a5e3976808e5736f6c9f
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Haowen-Bai/net-marvell-Use-min-instead-of-doing-it-manually/20220301-141800
git checkout 55e43d9d6e3e0a8774e6a5e3976808e5736f6c9f
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash drivers/net/ethernet/marvell/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

>> drivers/net/ethernet/marvell/mv643xx_eth.c:1664:21: warning: comparison of distinct pointer types ('typeof (er->rx_pending) *' (aka 'unsigned int *') and 'typeof (4096) *' (aka 'int *')) [-Wcompare-distinct-pointer-types]
mp->rx_ring_size = min(er->rx_pending, 4096);
^~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/minmax.h:45:19: note: expanded from macro 'min'
#define min(x, y) __careful_cmp(x, y, <)
^~~~~~~~~~~~~~~~~~~~~~
include/linux/minmax.h:36:24: note: expanded from macro '__careful_cmp'
__builtin_choose_expr(__safe_cmp(x, y), \
^~~~~~~~~~~~~~~~
include/linux/minmax.h:26:4: note: expanded from macro '__safe_cmp'
(__typecheck(x, y) && __no_side_effects(x, y))
^~~~~~~~~~~~~~~~~
include/linux/minmax.h:20:28: note: expanded from macro '__typecheck'
(!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~
1 warning generated.


vim +1664 drivers/net/ethernet/marvell/mv643xx_eth.c

1653
1654 static int
1655 mv643xx_eth_set_ringparam(struct net_device *dev, struct ethtool_ringparam *er,
1656 struct kernel_ethtool_ringparam *kernel_er,
1657 struct netlink_ext_ack *extack)
1658 {
1659 struct mv643xx_eth_private *mp = netdev_priv(dev);
1660
1661 if (er->rx_mini_pending || er->rx_jumbo_pending)
1662 return -EINVAL;
1663
> 1664 mp->rx_ring_size = min(er->rx_pending, 4096);
1665 mp->tx_ring_size = clamp_t(unsigned int, er->tx_pending,
1666 MV643XX_MAX_SKB_DESCS * 2, 4096);
1667 if (mp->tx_ring_size != er->tx_pending)
1668 netdev_warn(dev, "TX queue size set to %u (requested %u)\n",
1669 mp->tx_ring_size, er->tx_pending);
1670
1671 if (netif_running(dev)) {
1672 mv643xx_eth_stop(dev);
1673 if (mv643xx_eth_open(dev)) {
1674 netdev_err(dev,
1675 "fatal error on re-opening device after ring param change\n");
1676 return -ENOMEM;
1677 }
1678 }
1679
1680 return 0;
1681 }
1682

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx