drivers/net/wireless/mediatek/mt76/mt7915/mmio.c:341 __mt7915_reg_addr() warn: always true condition '(addr <= 4294967295) => (0-u32max <= u32max)'
From: kernel test robot
Date: Wed Aug 17 2022 - 22:21:00 EST
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 3b06a2755758937add738545ba4a544fc5a1c56d
commit: cd4c314a65d3cce6486f8303e42aca04fd9f9011 mt76: mt7915: refine register definition
date: 7 months ago
config: ia64-randconfig-m031-20220814 (https://download.01.org/0day-ci/archive/20220818/202208181013.Jmha89rK-lkp@xxxxxxxxx/config)
compiler: ia64-linux-gcc (GCC) 12.1.0
If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@xxxxxxxxx>
smatch warnings:
drivers/net/wireless/mediatek/mt76/mt7915/mmio.c:341 __mt7915_reg_addr() warn: always true condition '(addr <= 4294967295) => (0-u32max <= u32max)'
vim +341 drivers/net/wireless/mediatek/mt76/mt7915/mmio.c
311
312 static u32 __mt7915_reg_addr(struct mt7915_dev *dev, u32 addr)
313 {
314 int i;
315
316 if (addr < 0x100000)
317 return addr;
318
319 if (!dev->reg.map) {
320 dev_err(dev->mt76.dev, "err: reg_map is null\n");
321 return addr;
322 }
323
324 for (i = 0; i < dev->reg.map_size; i++) {
325 u32 ofs;
326
327 if (addr < dev->reg.map[i].phys)
328 continue;
329
330 ofs = addr - dev->reg.map[i].phys;
331 if (ofs > dev->reg.map[i].size)
332 continue;
333
334 return dev->reg.map[i].maps + ofs;
335 }
336
337 if ((addr >= MT_INFRA_BASE && addr < MT_WFSYS0_PHY_START) ||
338 (addr >= MT_WFSYS0_PHY_START && addr < MT_WFSYS1_PHY_START) ||
339 (addr >= MT_WFSYS1_PHY_START && addr <= MT_WFSYS1_PHY_END) ||
340 (addr >= MT_CBTOP1_PHY_START && addr <= MT_CBTOP1_PHY_END) ||
> 341 (addr >= MT_CBTOP2_PHY_START && addr <= MT_CBTOP2_PHY_END))
342 return mt7915_reg_map_l1(dev, addr);
343
344 return mt7915_reg_map_l2(dev, addr);
345 }
346
--
0-DAY CI Kernel Test Service
https://01.org/lkp