drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c:760:32: sparse: sparse: restricted __le16 degrades to integer

From: kernel test robot
Date: Sat Nov 11 2023 - 03:53:35 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 3ca112b71f35dd5d99fc4571a56b5fc6f0c15814
commit: a24cae7012b59bfe1aed01fe3fc13d81b7b97b08 net: stmmac: Fix sparse warning
date: 4 years ago
config: i386-randconfig-062-20230914 (https://download.01.org/0day-ci/archive/20231111/202311111644.CXvKwJam-lkp@xxxxxxxxx/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231111/202311111644.CXvKwJam-lkp@xxxxxxxxx/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202311111644.CXvKwJam-lkp@xxxxxxxxx/

sparse warnings: (new ones prefixed by >>)
>> drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c:760:32: sparse: sparse: restricted __le16 degrades to integer
--
>> drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c:594:32: sparse: sparse: restricted __le16 degrades to integer

vim +760 drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c

4ce84f4da7c472 Jose Abreu 2019-05-24 734
c1be0022df0dae Jose Abreu 2019-09-10 735 static void dwmac4_update_vlan_hash(struct mac_device_info *hw, u32 hash,
a24cae7012b59b Jose Abreu 2019-11-11 736 __le16 perfect_match, bool is_double)
c1be0022df0dae Jose Abreu 2019-09-10 737 {
c1be0022df0dae Jose Abreu 2019-09-10 738 void __iomem *ioaddr = hw->pcsr;
c1be0022df0dae Jose Abreu 2019-09-10 739
c1be0022df0dae Jose Abreu 2019-09-10 740 writel(hash, ioaddr + GMAC_VLAN_HASH_TABLE);
c1be0022df0dae Jose Abreu 2019-09-10 741
c1be0022df0dae Jose Abreu 2019-09-10 742 if (hash) {
c1be0022df0dae Jose Abreu 2019-09-10 743 u32 value = GMAC_VLAN_VTHM | GMAC_VLAN_ETV;
c1be0022df0dae Jose Abreu 2019-09-10 744 if (is_double) {
c1be0022df0dae Jose Abreu 2019-09-10 745 value |= GMAC_VLAN_EDVLP;
c1be0022df0dae Jose Abreu 2019-09-10 746 value |= GMAC_VLAN_ESVL;
c1be0022df0dae Jose Abreu 2019-09-10 747 value |= GMAC_VLAN_DOVLTC;
c1be0022df0dae Jose Abreu 2019-09-10 748 }
c1be0022df0dae Jose Abreu 2019-09-10 749
c1be0022df0dae Jose Abreu 2019-09-10 750 writel(value, ioaddr + GMAC_VLAN_TAG);
c7ab0b8088d7f0 Jose Abreu 2019-10-06 751 } else if (perfect_match) {
c7ab0b8088d7f0 Jose Abreu 2019-10-06 752 u32 value = GMAC_VLAN_ETV;
c7ab0b8088d7f0 Jose Abreu 2019-10-06 753
c7ab0b8088d7f0 Jose Abreu 2019-10-06 754 if (is_double) {
c7ab0b8088d7f0 Jose Abreu 2019-10-06 755 value |= GMAC_VLAN_EDVLP;
c7ab0b8088d7f0 Jose Abreu 2019-10-06 756 value |= GMAC_VLAN_ESVL;
c7ab0b8088d7f0 Jose Abreu 2019-10-06 757 value |= GMAC_VLAN_DOVLTC;
c7ab0b8088d7f0 Jose Abreu 2019-10-06 758 }
c7ab0b8088d7f0 Jose Abreu 2019-10-06 759
c7ab0b8088d7f0 Jose Abreu 2019-10-06 @760 writel(value | perfect_match, ioaddr + GMAC_VLAN_TAG);
c1be0022df0dae Jose Abreu 2019-09-10 761 } else {
c1be0022df0dae Jose Abreu 2019-09-10 762 u32 value = readl(ioaddr + GMAC_VLAN_TAG);
c1be0022df0dae Jose Abreu 2019-09-10 763
c1be0022df0dae Jose Abreu 2019-09-10 764 value &= ~(GMAC_VLAN_VTHM | GMAC_VLAN_ETV);
c1be0022df0dae Jose Abreu 2019-09-10 765 value &= ~(GMAC_VLAN_EDVLP | GMAC_VLAN_ESVL);
c1be0022df0dae Jose Abreu 2019-09-10 766 value &= ~GMAC_VLAN_DOVLTC;
c1be0022df0dae Jose Abreu 2019-09-10 767 value &= ~GMAC_VLAN_VID;
c1be0022df0dae Jose Abreu 2019-09-10 768
c1be0022df0dae Jose Abreu 2019-09-10 769 writel(value, ioaddr + GMAC_VLAN_TAG);
c1be0022df0dae Jose Abreu 2019-09-10 770 }
c1be0022df0dae Jose Abreu 2019-09-10 771 }
c1be0022df0dae Jose Abreu 2019-09-10 772

:::::: The code at line 760 was first introduced by commit
:::::: c7ab0b8088d7f023f543013963f23aecc7e47efb net: stmmac: Fallback to VLAN Perfect filtering if HASH is not available

:::::: TO: Jose Abreu <joabreu@xxxxxxxxxxxx>
:::::: CC: David S. Miller <davem@xxxxxxxxxxxxx>

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki