drivers/net/ethernet/realtek/r8169_main.c:1872 rtl_coalesce_choose_scale() warn: passing a valid pointer to 'PTR_ERR'

From: kernel test robot
Date: Tue Aug 11 2020 - 23:12:27 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: bb5baaa9238ecf8f13b112232c7bbe0d3d598ee8
commit: 2815b30535a0613ee07d477d0c628100f40b6059 r8169: merge scale for tx and rx irq coalescing
date: 3 months ago
config: parisc-randconfig-m031-20200811 (attached as .config)
compiler: hppa-linux-gcc (GCC) 9.3.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/realtek/r8169_main.c:1872 rtl_coalesce_choose_scale() warn: passing a valid pointer to 'PTR_ERR'

Old smatch warnings:
drivers/net/ethernet/realtek/r8169_main.c:1837 rtl_get_coalesce() warn: passing a valid pointer to 'PTR_ERR'

vim +/PTR_ERR +1872 drivers/net/ethernet/realtek/r8169_main.c

1862
1863 /* choose appropriate scale factor and CPlusCmd[0:1] for (speed, nsec) */
1864 static int rtl_coalesce_choose_scale(struct rtl8169_private *tp, u32 nsec,
1865 u16 *cp01)
1866 {
1867 const struct rtl_coalesce_info *ci;
1868 u16 i;
1869
1870 ci = rtl_coalesce_info(tp);
1871 if (IS_ERR(ci))
> 1872 return PTR_ERR(ci);
1873
1874 for (i = 0; i < 4; i++) {
1875 if (nsec <= ci->scale_nsecs[i] * RTL_COALESCE_T_MAX) {
1876 *cp01 = i;
1877 return ci->scale_nsecs[i];
1878 }
1879 }
1880
1881 return -EINVAL;
1882 }
1883

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

Attachment: .config.gz
Description: application/gzip