Re: [PATCH] net: macb: Remove redundant assignment to w0 and queue

From: kernel test robot
Date: Wed Apr 28 2021 - 12:21:16 EST


Hi Jiapeng,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on linus/master]
[also build test WARNING on v5.12 next-20210428]
[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/Jiapeng-Chong/net-macb-Remove-redundant-assignment-to-w0-and-queue/20210428-180547
base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git acd3d28594536e9096c1ea76c5867d8a68babef6
config: i386-randconfig-s001-20210428 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.3-341-g8af24329-dirty
# https://github.com/0day-ci/linux/commit/baa719bc71d10dc85036336b0c1b1556da2339a6
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Jiapeng-Chong/net-macb-Remove-redundant-assignment-to-w0-and-queue/20210428-180547
git checkout baa719bc71d10dc85036336b0c1b1556da2339a6
# save the attached .config to linux build tree
make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' W=1 ARCH=i386

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


sparse warnings: (new ones prefixed by >>)
drivers/net/ethernet/cadence/macb_main.c:282:16: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] bottom @@ got restricted __le32 [usertype] @@
drivers/net/ethernet/cadence/macb_main.c:282:16: sparse: expected unsigned int [usertype] bottom
drivers/net/ethernet/cadence/macb_main.c:282:16: sparse: got restricted __le32 [usertype]
drivers/net/ethernet/cadence/macb_main.c:284:13: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned short [usertype] top @@ got restricted __le16 [usertype] @@
drivers/net/ethernet/cadence/macb_main.c:284:13: sparse: expected unsigned short [usertype] top
drivers/net/ethernet/cadence/macb_main.c:284:13: sparse: got restricted __le16 [usertype]
drivers/net/ethernet/cadence/macb_main.c:3214:39: sparse: sparse: restricted __be32 degrades to integer
drivers/net/ethernet/cadence/macb_main.c:3219:39: sparse: sparse: restricted __be32 degrades to integer
drivers/net/ethernet/cadence/macb_main.c:3224:40: sparse: sparse: restricted __be16 degrades to integer
drivers/net/ethernet/cadence/macb_main.c:3224:69: sparse: sparse: restricted __be16 degrades to integer
drivers/net/ethernet/cadence/macb_main.c:3249:20: sparse: sparse: restricted __be32 degrades to integer
>> drivers/net/ethernet/cadence/macb_main.c:3252:20: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] w0 @@ got restricted __be32 [usertype] ip4src @@
drivers/net/ethernet/cadence/macb_main.c:3252:20: sparse: expected unsigned int [usertype] w0
drivers/net/ethernet/cadence/macb_main.c:3252:20: sparse: got restricted __be32 [usertype] ip4src
drivers/net/ethernet/cadence/macb_main.c:3262:20: sparse: sparse: restricted __be32 degrades to integer
>> drivers/net/ethernet/cadence/macb_main.c:3265:20: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] w0 @@ got restricted __be32 [usertype] ip4dst @@
drivers/net/ethernet/cadence/macb_main.c:3265:20: sparse: expected unsigned int [usertype] w0
drivers/net/ethernet/cadence/macb_main.c:3265:20: sparse: got restricted __be32 [usertype] ip4dst
drivers/net/ethernet/cadence/macb_main.c:3275:21: sparse: sparse: restricted __be16 degrades to integer
drivers/net/ethernet/cadence/macb_main.c:3275:50: sparse: sparse: restricted __be16 degrades to integer
drivers/net/ethernet/cadence/macb_main.c:3281:30: sparse: sparse: restricted __be16 degrades to integer
drivers/net/ethernet/cadence/macb_main.c:3282:30: sparse: sparse: restricted __be16 degrades to integer
drivers/net/ethernet/cadence/macb_main.c:3289:36: sparse: sparse: restricted __be16 degrades to integer
drivers/net/ethernet/cadence/macb_main.c:3290:38: sparse: sparse: restricted __be16 degrades to integer
drivers/net/ethernet/cadence/macb_main.c:3293:38: sparse: sparse: restricted __be16 degrades to integer
drivers/net/ethernet/cadence/macb_main.c:3329:9: sparse: sparse: cast from restricted __be32
drivers/net/ethernet/cadence/macb_main.c:3329:9: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int [usertype] val @@ got restricted __be32 [usertype] ip4src @@
drivers/net/ethernet/cadence/macb_main.c:3329:9: sparse: expected unsigned int [usertype] val
drivers/net/ethernet/cadence/macb_main.c:3329:9: sparse: got restricted __be32 [usertype] ip4src
drivers/net/ethernet/cadence/macb_main.c:3329:9: sparse: sparse: cast from restricted __be32
drivers/net/ethernet/cadence/macb_main.c:3329:9: sparse: sparse: cast from restricted __be32
drivers/net/ethernet/cadence/macb_main.c:3329:9: sparse: sparse: cast from restricted __be32
drivers/net/ethernet/cadence/macb_main.c:3329:9: sparse: sparse: cast from restricted __be32
drivers/net/ethernet/cadence/macb_main.c:3329:9: sparse: sparse: cast from restricted __be32
drivers/net/ethernet/cadence/macb_main.c:3329:9: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int [usertype] val @@ got restricted __be32 [usertype] ip4dst @@
drivers/net/ethernet/cadence/macb_main.c:3329:9: sparse: expected unsigned int [usertype] val
drivers/net/ethernet/cadence/macb_main.c:3329:9: sparse: got restricted __be32 [usertype] ip4dst
drivers/net/ethernet/cadence/macb_main.c:3329:9: sparse: sparse: cast from restricted __be32
drivers/net/ethernet/cadence/macb_main.c:3329:9: sparse: sparse: cast from restricted __be32
drivers/net/ethernet/cadence/macb_main.c:3329:9: sparse: sparse: cast from restricted __be32
drivers/net/ethernet/cadence/macb_main.c:3329:9: sparse: sparse: cast from restricted __be32
drivers/net/ethernet/cadence/macb_main.c:3329:9: sparse: sparse: cast from restricted __be16
drivers/net/ethernet/cadence/macb_main.c:3329:9: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned short [usertype] val @@ got restricted __be16 [usertype] psrc @@
drivers/net/ethernet/cadence/macb_main.c:3329:9: sparse: expected unsigned short [usertype] val
drivers/net/ethernet/cadence/macb_main.c:3329:9: sparse: got restricted __be16 [usertype] psrc
drivers/net/ethernet/cadence/macb_main.c:3329:9: sparse: sparse: cast from restricted __be16
drivers/net/ethernet/cadence/macb_main.c:3329:9: sparse: sparse: cast from restricted __be16
drivers/net/ethernet/cadence/macb_main.c:3329:9: sparse: sparse: cast from restricted __be16
drivers/net/ethernet/cadence/macb_main.c:3329:9: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned short [usertype] val @@ got restricted __be16 [usertype] pdst @@
drivers/net/ethernet/cadence/macb_main.c:3329:9: sparse: expected unsigned short [usertype] val
drivers/net/ethernet/cadence/macb_main.c:3329:9: sparse: got restricted __be16 [usertype] pdst
drivers/net/ethernet/cadence/macb_main.c:3329:9: sparse: sparse: cast from restricted __be16
drivers/net/ethernet/cadence/macb_main.c:3329:9: sparse: sparse: cast from restricted __be16
drivers/net/ethernet/cadence/macb_main.c:3382:25: sparse: sparse: cast from restricted __be32
drivers/net/ethernet/cadence/macb_main.c:3382:25: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int [usertype] val @@ got restricted __be32 [usertype] ip4src @@
drivers/net/ethernet/cadence/macb_main.c:3382:25: sparse: expected unsigned int [usertype] val
drivers/net/ethernet/cadence/macb_main.c:3382:25: sparse: got restricted __be32 [usertype] ip4src
drivers/net/ethernet/cadence/macb_main.c:3382:25: sparse: sparse: cast from restricted __be32
drivers/net/ethernet/cadence/macb_main.c:3382:25: sparse: sparse: cast from restricted __be32
drivers/net/ethernet/cadence/macb_main.c:3382:25: sparse: sparse: cast from restricted __be32
drivers/net/ethernet/cadence/macb_main.c:3382:25: sparse: sparse: cast from restricted __be32
drivers/net/ethernet/cadence/macb_main.c:3382:25: sparse: sparse: cast from restricted __be32
drivers/net/ethernet/cadence/macb_main.c:3382:25: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int [usertype] val @@ got restricted __be32 [usertype] ip4dst @@
drivers/net/ethernet/cadence/macb_main.c:3382:25: sparse: expected unsigned int [usertype] val
drivers/net/ethernet/cadence/macb_main.c:3382:25: sparse: got restricted __be32 [usertype] ip4dst
drivers/net/ethernet/cadence/macb_main.c:3382:25: sparse: sparse: cast from restricted __be32
drivers/net/ethernet/cadence/macb_main.c:3382:25: sparse: sparse: cast from restricted __be32
drivers/net/ethernet/cadence/macb_main.c:3382:25: sparse: sparse: cast from restricted __be32
drivers/net/ethernet/cadence/macb_main.c:3382:25: sparse: sparse: cast from restricted __be32
drivers/net/ethernet/cadence/macb_main.c:3382:25: sparse: sparse: cast from restricted __be16
drivers/net/ethernet/cadence/macb_main.c:3382:25: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned short [usertype] val @@ got restricted __be16 [usertype] psrc @@
drivers/net/ethernet/cadence/macb_main.c:3382:25: sparse: expected unsigned short [usertype] val
drivers/net/ethernet/cadence/macb_main.c:3382:25: sparse: got restricted __be16 [usertype] psrc
drivers/net/ethernet/cadence/macb_main.c:3382:25: sparse: sparse: cast from restricted __be16
drivers/net/ethernet/cadence/macb_main.c:3382:25: sparse: sparse: cast from restricted __be16
drivers/net/ethernet/cadence/macb_main.c:3382:25: sparse: sparse: cast from restricted __be16
drivers/net/ethernet/cadence/macb_main.c:3382:25: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned short [usertype] val @@ got restricted __be16 [usertype] pdst @@
drivers/net/ethernet/cadence/macb_main.c:3382:25: sparse: expected unsigned short [usertype] val
drivers/net/ethernet/cadence/macb_main.c:3382:25: sparse: got restricted __be16 [usertype] pdst
drivers/net/ethernet/cadence/macb_main.c:3382:25: sparse: sparse: cast from restricted __be16
drivers/net/ethernet/cadence/macb_main.c:3382:25: sparse: sparse: cast from restricted __be16

vim +3252 drivers/net/ethernet/cadence/macb_main.c

ae8223de3df5a0 Rafal Ozieblo 2017-11-30 3232
ae8223de3df5a0 Rafal Ozieblo 2017-11-30 3233 static void gem_prog_cmp_regs(struct macb *bp, struct ethtool_rx_flow_spec *fs)
ae8223de3df5a0 Rafal Ozieblo 2017-11-30 3234 {
ae8223de3df5a0 Rafal Ozieblo 2017-11-30 3235 struct ethtool_tcpip4_spec *tp4sp_v, *tp4sp_m;
ae8223de3df5a0 Rafal Ozieblo 2017-11-30 3236 uint16_t index = fs->location;
ae8223de3df5a0 Rafal Ozieblo 2017-11-30 3237 u32 w0, w1, t2_scr;
ae8223de3df5a0 Rafal Ozieblo 2017-11-30 3238 bool cmp_a = false;
ae8223de3df5a0 Rafal Ozieblo 2017-11-30 3239 bool cmp_b = false;
ae8223de3df5a0 Rafal Ozieblo 2017-11-30 3240 bool cmp_c = false;
ae8223de3df5a0 Rafal Ozieblo 2017-11-30 3241
a14d273ba15968 Claudiu Beznea 2021-04-02 3242 if (!macb_is_gem(bp))
a14d273ba15968 Claudiu Beznea 2021-04-02 3243 return;
a14d273ba15968 Claudiu Beznea 2021-04-02 3244
ae8223de3df5a0 Rafal Ozieblo 2017-11-30 3245 tp4sp_v = &(fs->h_u.tcp_ip4_spec);
ae8223de3df5a0 Rafal Ozieblo 2017-11-30 3246 tp4sp_m = &(fs->m_u.tcp_ip4_spec);
ae8223de3df5a0 Rafal Ozieblo 2017-11-30 3247
ae8223de3df5a0 Rafal Ozieblo 2017-11-30 3248 /* ignore field if any masking set */
ae8223de3df5a0 Rafal Ozieblo 2017-11-30 3249 if (tp4sp_m->ip4src == 0xFFFFFFFF) {
ae8223de3df5a0 Rafal Ozieblo 2017-11-30 3250 /* 1st compare reg - IP source address */
ae8223de3df5a0 Rafal Ozieblo 2017-11-30 3251 w1 = 0;
ae8223de3df5a0 Rafal Ozieblo 2017-11-30 @3252 w0 = tp4sp_v->ip4src;
ae8223de3df5a0 Rafal Ozieblo 2017-11-30 3253 w1 = GEM_BFINS(T2DISMSK, 1, w1); /* 32-bit compare */
ae8223de3df5a0 Rafal Ozieblo 2017-11-30 3254 w1 = GEM_BFINS(T2CMPOFST, GEM_T2COMPOFST_ETYPE, w1);
ae8223de3df5a0 Rafal Ozieblo 2017-11-30 3255 w1 = GEM_BFINS(T2OFST, ETYPE_SRCIP_OFFSET, w1);
ae8223de3df5a0 Rafal Ozieblo 2017-11-30 3256 gem_writel_n(bp, T2CMPW0, T2CMP_OFST(GEM_IP4SRC_CMP(index)), w0);
ae8223de3df5a0 Rafal Ozieblo 2017-11-30 3257 gem_writel_n(bp, T2CMPW1, T2CMP_OFST(GEM_IP4SRC_CMP(index)), w1);
ae8223de3df5a0 Rafal Ozieblo 2017-11-30 3258 cmp_a = true;
ae8223de3df5a0 Rafal Ozieblo 2017-11-30 3259 }
ae8223de3df5a0 Rafal Ozieblo 2017-11-30 3260
ae8223de3df5a0 Rafal Ozieblo 2017-11-30 3261 /* ignore field if any masking set */
ae8223de3df5a0 Rafal Ozieblo 2017-11-30 3262 if (tp4sp_m->ip4dst == 0xFFFFFFFF) {
ae8223de3df5a0 Rafal Ozieblo 2017-11-30 3263 /* 2nd compare reg - IP destination address */
ae8223de3df5a0 Rafal Ozieblo 2017-11-30 3264 w1 = 0;
ae8223de3df5a0 Rafal Ozieblo 2017-11-30 @3265 w0 = tp4sp_v->ip4dst;
ae8223de3df5a0 Rafal Ozieblo 2017-11-30 3266 w1 = GEM_BFINS(T2DISMSK, 1, w1); /* 32-bit compare */
ae8223de3df5a0 Rafal Ozieblo 2017-11-30 3267 w1 = GEM_BFINS(T2CMPOFST, GEM_T2COMPOFST_ETYPE, w1);
ae8223de3df5a0 Rafal Ozieblo 2017-11-30 3268 w1 = GEM_BFINS(T2OFST, ETYPE_DSTIP_OFFSET, w1);
ae8223de3df5a0 Rafal Ozieblo 2017-11-30 3269 gem_writel_n(bp, T2CMPW0, T2CMP_OFST(GEM_IP4DST_CMP(index)), w0);
ae8223de3df5a0 Rafal Ozieblo 2017-11-30 3270 gem_writel_n(bp, T2CMPW1, T2CMP_OFST(GEM_IP4DST_CMP(index)), w1);
ae8223de3df5a0 Rafal Ozieblo 2017-11-30 3271 cmp_b = true;
ae8223de3df5a0 Rafal Ozieblo 2017-11-30 3272 }
ae8223de3df5a0 Rafal Ozieblo 2017-11-30 3273
ae8223de3df5a0 Rafal Ozieblo 2017-11-30 3274 /* ignore both port fields if masking set in both */
ae8223de3df5a0 Rafal Ozieblo 2017-11-30 3275 if ((tp4sp_m->psrc == 0xFFFF) || (tp4sp_m->pdst == 0xFFFF)) {
ae8223de3df5a0 Rafal Ozieblo 2017-11-30 3276 /* 3rd compare reg - source port, destination port */
ae8223de3df5a0 Rafal Ozieblo 2017-11-30 3277 w0 = 0;
ae8223de3df5a0 Rafal Ozieblo 2017-11-30 3278 w1 = 0;
ae8223de3df5a0 Rafal Ozieblo 2017-11-30 3279 w1 = GEM_BFINS(T2CMPOFST, GEM_T2COMPOFST_IPHDR, w1);
ae8223de3df5a0 Rafal Ozieblo 2017-11-30 3280 if (tp4sp_m->psrc == tp4sp_m->pdst) {
ae8223de3df5a0 Rafal Ozieblo 2017-11-30 3281 w0 = GEM_BFINS(T2MASK, tp4sp_v->psrc, w0);
ae8223de3df5a0 Rafal Ozieblo 2017-11-30 3282 w0 = GEM_BFINS(T2CMP, tp4sp_v->pdst, w0);
ae8223de3df5a0 Rafal Ozieblo 2017-11-30 3283 w1 = GEM_BFINS(T2DISMSK, 1, w1); /* 32-bit compare */
ae8223de3df5a0 Rafal Ozieblo 2017-11-30 3284 w1 = GEM_BFINS(T2OFST, IPHDR_SRCPORT_OFFSET, w1);
ae8223de3df5a0 Rafal Ozieblo 2017-11-30 3285 } else {
ae8223de3df5a0 Rafal Ozieblo 2017-11-30 3286 /* only one port definition */
ae8223de3df5a0 Rafal Ozieblo 2017-11-30 3287 w1 = GEM_BFINS(T2DISMSK, 0, w1); /* 16-bit compare */
ae8223de3df5a0 Rafal Ozieblo 2017-11-30 3288 w0 = GEM_BFINS(T2MASK, 0xFFFF, w0);
ae8223de3df5a0 Rafal Ozieblo 2017-11-30 3289 if (tp4sp_m->psrc == 0xFFFF) { /* src port */
ae8223de3df5a0 Rafal Ozieblo 2017-11-30 3290 w0 = GEM_BFINS(T2CMP, tp4sp_v->psrc, w0);
ae8223de3df5a0 Rafal Ozieblo 2017-11-30 3291 w1 = GEM_BFINS(T2OFST, IPHDR_SRCPORT_OFFSET, w1);
ae8223de3df5a0 Rafal Ozieblo 2017-11-30 3292 } else { /* dst port */
ae8223de3df5a0 Rafal Ozieblo 2017-11-30 3293 w0 = GEM_BFINS(T2CMP, tp4sp_v->pdst, w0);
ae8223de3df5a0 Rafal Ozieblo 2017-11-30 3294 w1 = GEM_BFINS(T2OFST, IPHDR_DSTPORT_OFFSET, w1);
ae8223de3df5a0 Rafal Ozieblo 2017-11-30 3295 }
ae8223de3df5a0 Rafal Ozieblo 2017-11-30 3296 }
ae8223de3df5a0 Rafal Ozieblo 2017-11-30 3297 gem_writel_n(bp, T2CMPW0, T2CMP_OFST(GEM_PORT_CMP(index)), w0);
ae8223de3df5a0 Rafal Ozieblo 2017-11-30 3298 gem_writel_n(bp, T2CMPW1, T2CMP_OFST(GEM_PORT_CMP(index)), w1);
ae8223de3df5a0 Rafal Ozieblo 2017-11-30 3299 cmp_c = true;
ae8223de3df5a0 Rafal Ozieblo 2017-11-30 3300 }
ae8223de3df5a0 Rafal Ozieblo 2017-11-30 3301
ae8223de3df5a0 Rafal Ozieblo 2017-11-30 3302 t2_scr = 0;
ae8223de3df5a0 Rafal Ozieblo 2017-11-30 3303 t2_scr = GEM_BFINS(QUEUE, (fs->ring_cookie) & 0xFF, t2_scr);
ae8223de3df5a0 Rafal Ozieblo 2017-11-30 3304 t2_scr = GEM_BFINS(ETHT2IDX, SCRT2_ETHT, t2_scr);
ae8223de3df5a0 Rafal Ozieblo 2017-11-30 3305 if (cmp_a)
ae8223de3df5a0 Rafal Ozieblo 2017-11-30 3306 t2_scr = GEM_BFINS(CMPA, GEM_IP4SRC_CMP(index), t2_scr);
ae8223de3df5a0 Rafal Ozieblo 2017-11-30 3307 if (cmp_b)
ae8223de3df5a0 Rafal Ozieblo 2017-11-30 3308 t2_scr = GEM_BFINS(CMPB, GEM_IP4DST_CMP(index), t2_scr);
ae8223de3df5a0 Rafal Ozieblo 2017-11-30 3309 if (cmp_c)
ae8223de3df5a0 Rafal Ozieblo 2017-11-30 3310 t2_scr = GEM_BFINS(CMPC, GEM_PORT_CMP(index), t2_scr);
ae8223de3df5a0 Rafal Ozieblo 2017-11-30 3311 gem_writel_n(bp, SCRT2, index, t2_scr);
ae8223de3df5a0 Rafal Ozieblo 2017-11-30 3312 }
ae8223de3df5a0 Rafal Ozieblo 2017-11-30 3313

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

Attachment: .config.gz
Description: application/gzip