tree:
https://github.com/lunn/linux.git v5.7-rc4-net-next-cable-test-tdr
head: a18dce53d5a2412c66b0bf6c4ad36a027133fb7d
commit: c2574fa18c705975cfec42a962b391bec02a2090 [5/6] net: ethtool: Allow PHY cable test
TDR data to configured
config: arc-vdk_hs38_defconfig (attached as .config)
compiler: arc-elf-gcc (GCC) 9.3.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
git checkout c2574fa18c705975cfec42a962b391bec02a2090
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arc
If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp(a)intel.com>
All warnings (new ones prefixed by >>, old ones prefixed by <<):
net/ethtool/cabletest.c: In function 'ethnl_act_cable_test_tdr':
> net/ethtool/cabletest.c:270:12: warning: comparison is always
false due to limited range of data type [-Wtype-limits]
270 | if (pair <
ETHTOOL_A_CABLE_PAIR_A ||
| ^
vim +270 net/ethtool/cabletest.c
225
226 int ethnl_act_cable_test_tdr(struct sk_buff *skb, struct genl_info *info)
227 {
228 struct nlattr *tb[ETHTOOL_A_CABLE_TEST_TDR_MAX + 1];
229 struct ethnl_req_info req_info = {};
230 struct net_device *dev;
231 u32 first, last, step;
232 int ret;
233 u8 pair;
234
235 ret = nlmsg_parse(info->nlhdr, GENL_HDRLEN, tb,
236 ETHTOOL_A_CABLE_TEST_TDR_MAX,
237 cable_test_tdr_act_policy, info->extack);
238 if (ret < 0)
239 return ret;
240
241 ret = ethnl_parse_header_dev_get(&req_info,
242 tb[ETHTOOL_A_CABLE_TEST_TDR_HEADER],
243 genl_info_net(info), info->extack,
244 true);
245 if (ret < 0)
246 return ret;
247
248 dev = req_info.dev;
249 if (!dev->phydev) {
250 ret = -EOPNOTSUPP;
251 goto out_dev_put;
252 }
253
254 if (tb[ETHTOOL_A_CABLE_TEST_TDR_FIRST])
255 first = nla_get_u32(tb[ETHTOOL_A_CABLE_TEST_TDR_FIRST]);
256 else
257 first = 100;
258 if (tb[ETHTOOL_A_CABLE_TEST_TDR_LAST])
259 last = nla_get_u32(tb[ETHTOOL_A_CABLE_TEST_TDR_LAST]);
260 else
261 last = MAX_CABLE_LENGTH_CM;
262
263 if (tb[ETHTOOL_A_CABLE_TEST_TDR_STEP])
264 step = nla_get_u32(tb[ETHTOOL_A_CABLE_TEST_TDR_STEP]);
265 else
266 step = 100;
267
268 if (tb[ETHTOOL_A_CABLE_TEST_TDR_PAIR]) {
269 pair = nla_get_u8(tb[ETHTOOL_A_CABLE_TEST_TDR_PAIR]);
270 if (pair < ETHTOOL_A_CABLE_PAIR_A ||
271 pair
> ETHTOOL_A_CABLE_PAIR_D) {
272 NL_SET_ERR_MSG(info->extack,
273 "invalid pair parameter");
274 return -EINVAL;
275 }
276 } else {
277 pair = PHY_PAIR_ALL;
278 }
279
280 if (first > MAX_CABLE_LENGTH_CM) {
281 NL_SET_ERR_MSG(info->extack, "invalid first parameter");
282 return -EINVAL;
283 }
284
285 if (last > MAX_CABLE_LENGTH_CM) {
286 NL_SET_ERR_MSG(info->extack, "invalid last parameter");
287 return -EINVAL;
288 }
289
290 if (first > last) {
291 NL_SET_ERR_MSG(info->extack, "invalid first/last parameter");
292 return -EINVAL;
293 }
294
295 if (!step) {
296 NL_SET_ERR_MSG(info->extack, "invalid step parameter");
297 return -EINVAL;
298 }
299
300 rtnl_lock();
301 ret = ethnl_ops_begin(dev);
302 if (ret < 0)
303 goto out_rtnl;
304
305 ret = phy_start_cable_test_tdr(dev->phydev, info->extack,
306 first, last, step, pair);
307
308 ethnl_ops_complete(dev);
309
310 if (!ret)
311 ethnl_cable_test_started(dev->phydev,
312 ETHTOOL_MSG_CABLE_TEST_TDR_NTF);
313
314 out_rtnl:
315 rtnl_unlock();
316 out_dev_put:
317 dev_put(dev);
318 return ret;
319 }
320
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org