[jpirko-mlxsw:petrm_soft_counters 7/7] net/core/rtnetlink.c:5101:22: error: unused variable 'size'

From: kernel test robot
Date: Fri Nov 12 2021 - 17:52:39 EST


tree: https://github.com/jpirko/linux_mlxsw petrm_soft_counters
head: d35d00a6d28ff7a34145438df3a2b39abd00edc3
commit: d35d00a6d28ff7a34145438df3a2b39abd00edc3 [7/7] wip
config: openrisc-buildonly-randconfig-r003-20211111 (attached as .config)
compiler: or1k-linux-gcc (GCC) 11.2.0
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/jpirko/linux_mlxsw/commit/d35d00a6d28ff7a34145438df3a2b39abd00edc3
git remote add jpirko-mlxsw https://github.com/jpirko/linux_mlxsw
git fetch --no-tags jpirko-mlxsw petrm_soft_counters
git checkout d35d00a6d28ff7a34145438df3a2b39abd00edc3
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=openrisc

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

All errors (new ones prefixed by >>):

net/core/rtnetlink.c: In function 'rtnl_offload_xstats_fill_hw_stats':
>> net/core/rtnetlink.c:5101:22: error: unused variable 'size' [-Werror=unused-variable]
5101 | unsigned int size = info->get_size(info, dev);
| ^~~~
cc1: all warnings being treated as errors


vim +/size +5101 net/core/rtnetlink.c

5095
5096 static int
5097 rtnl_offload_xstats_fill_hw_stats(const struct rtnl_offload_xstats_info *info,
5098 struct net_device *dev, struct sk_buff *skb,
5099 struct netlink_ext_ack *extack)
5100 {
> 5101 unsigned int size = info->get_size(info, dev);
5102 enum netdev_hw_stats_type used_hw_stats = 0;
5103 struct rtnl_link_stats64 stats;
5104 struct nlattr *nest;
5105 int err;
5106
5107 nest = nla_nest_start_noflag(skb, info->attr_id);
5108 if (!nest)
5109 return -EMSGSIZE;
5110
5111 if (dev->offload_hw_stats) {
5112 err = netdev_offload_xstats_hw_stats_get(dev, &stats,
5113 &used_hw_stats,
5114 extack);
5115 if (err)
5116 goto nla_put_failure;
5117
5118 if (nla_put_64bit(skb, IFLA_OFFLOAD_XSTATS_HW_STATS_STATS,
5119 sizeof(stats), &stats,
5120 IFLA_OFFLOAD_XSTATS_UNSPEC))
5121 goto nla_put_failure;
5122 }
5123
5124 if (nla_put_bitfield32(skb, IFLA_OFFLOAD_XSTATS_HW_STATS_USED_TYPE,
5125 used_hw_stats, IFLA_HW_STATS_ANY))
5126 goto nla_put_failure;
5127
5128 nla_nest_end(skb, nest);
5129 return 0;
5130
5131 nla_put_failure:
5132 nla_nest_cancel(skb, nest);
5133 return -EMSGSIZE;
5134 }
5135

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

Attachment: .config.gz
Description: application/gzip