drivers/net/ethernet/brocade/bna/bfa_ioc.c:1904:24: sparse: sparse: incorrect type in argument 1 (different base types)

From: kernel test robot
Date: Fri Jan 20 2023 - 06:47:05 EST


Hi Stafford,

First bad commit (maybe != root cause):

tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: d368967cb1039b5c4cccb62b5a4b9468c50cd143
commit: ded2ee36313c941f1a12b6f85cde295b575264ae openrisc: Add pci bus support
date: 6 months ago
config: openrisc-randconfig-s052-20230120 (https://download.01.org/0day-ci/archive/20230120/202301201932.5wnJEdwo-lkp@xxxxxxxxx/config)
compiler: or1k-linux-gcc (GCC) 12.1.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.4-39-gce1a6720-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=ded2ee36313c941f1a12b6f85cde295b575264ae
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout ded2ee36313c941f1a12b6f85cde295b575264ae
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=openrisc olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=openrisc SHELL=/bin/bash drivers/net/ethernet/

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

sparse warnings: (new ones prefixed by >>)
drivers/net/ethernet/brocade/bna/bfa_ioc.c:1924:28: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned short [assigned] [usertype] clscode @@ got restricted __be16 [usertype] @@
drivers/net/ethernet/brocade/bna/bfa_ioc.c:1924:28: sparse: expected unsigned short [assigned] [usertype] clscode
drivers/net/ethernet/brocade/bna/bfa_ioc.c:1924:28: sparse: got restricted __be16 [usertype]
drivers/net/ethernet/brocade/bna/bfa_ioc.c:1925:25: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned short [assigned] [usertype] rsvd @@ got restricted __be16 [usertype] @@
drivers/net/ethernet/brocade/bna/bfa_ioc.c:1925:25: sparse: expected unsigned short [assigned] [usertype] rsvd
drivers/net/ethernet/brocade/bna/bfa_ioc.c:1925:25: sparse: got restricted __be16 [usertype]
drivers/net/ethernet/brocade/bna/bfa_ioc.c:1927:29: sparse: sparse: cast to restricted __be32
drivers/net/ethernet/brocade/bna/bfa_ioc.c:1938:29: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned short [assigned] [usertype] clscode @@ got restricted __be16 [usertype] @@
drivers/net/ethernet/brocade/bna/bfa_ioc.c:1938:29: sparse: expected unsigned short [assigned] [usertype] clscode
drivers/net/ethernet/brocade/bna/bfa_ioc.c:1938:29: sparse: got restricted __be16 [usertype]
drivers/net/ethernet/brocade/bna/bfa_ioc.c:1939:26: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned short [assigned] [usertype] rsvd @@ got restricted __be16 [usertype] @@
drivers/net/ethernet/brocade/bna/bfa_ioc.c:1939:26: sparse: expected unsigned short [assigned] [usertype] rsvd
drivers/net/ethernet/brocade/bna/bfa_ioc.c:1939:26: sparse: got restricted __be16 [usertype]
drivers/net/ethernet/brocade/bna/bfa_ioc.c:1941:30: sparse: sparse: cast to restricted __be32
>> drivers/net/ethernet/brocade/bna/bfa_ioc.c:1904:24: sparse: sparse: incorrect type in argument 1 (different base types) @@ expected unsigned int [usertype] value @@ got restricted __le32 [usertype] @@
drivers/net/ethernet/brocade/bna/bfa_ioc.c:1904:24: sparse: expected unsigned int [usertype] value
drivers/net/ethernet/brocade/bna/bfa_ioc.c:1904:24: sparse: got restricted __le32 [usertype]
drivers/net/ethernet/brocade/bna/bfa_ioc.c:2106:31: sparse: sparse: cast to restricted __be32
drivers/net/ethernet/brocade/bna/bfa_ioc.c:2107:31: sparse: sparse: cast to restricted __be32
drivers/net/ethernet/brocade/bna/bfa_ioc.c:2108:31: sparse: sparse: cast to restricted __be16
drivers/net/ethernet/brocade/bna/bfa_ioc.c:2210:26: sparse: sparse: cast to restricted __be32
drivers/net/ethernet/brocade/bna/bfa_ioc.c:2423:25: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] @@ got restricted __be32 [usertype] @@
drivers/net/ethernet/brocade/bna/bfa_ioc.c:2423:25: sparse: expected unsigned int [usertype]
drivers/net/ethernet/brocade/bna/bfa_ioc.c:2423:25: sparse: got restricted __be32 [usertype]
drivers/net/ethernet/brocade/bna/bfa_ioc.c:3069:21: sparse: sparse: cast to restricted __be32
drivers/net/ethernet/brocade/bna/bfa_ioc.c:3071:23: sparse: sparse: cast to restricted __be32
drivers/net/ethernet/brocade/bna/bfa_ioc.c:3074:23: sparse: sparse: cast to restricted __be32
drivers/net/ethernet/brocade/bna/bfa_ioc.c:3102:21: sparse: sparse: cast to restricted __be32
drivers/net/ethernet/brocade/bna/bfa_ioc.c:3104:23: sparse: sparse: cast to restricted __be32
drivers/net/ethernet/brocade/bna/bfa_ioc.c:3107:23: sparse: sparse: cast to restricted __be32
drivers/net/ethernet/brocade/bna/bfa_ioc.c:3141:26: sparse: sparse: cast to restricted __be32
drivers/net/ethernet/brocade/bna/bfa_ioc.c:3148:40: sparse: sparse: cast to restricted __be32
drivers/net/ethernet/brocade/bna/bfa_ioc.c:3149:39: sparse: sparse: cast to restricted __be32
drivers/net/ethernet/brocade/bna/bfa_ioc.c:3152:41: sparse: sparse: cast to restricted __be32
drivers/net/ethernet/brocade/bna/bfa_ioc.c:3154:41: sparse: sparse: cast to restricted __be32
drivers/net/ethernet/brocade/bna/bfa_ioc.c:3156:41: sparse: sparse: cast to restricted __be32
drivers/net/ethernet/brocade/bna/bfa_ioc.c:3158:41: sparse: sparse: cast to restricted __be32
drivers/net/ethernet/brocade/bna/bfa_ioc.c:3160:41: sparse: sparse: cast to restricted __be32
drivers/net/ethernet/brocade/bna/bfa_ioc.c:3162:41: sparse: sparse: cast to restricted __be32
drivers/net/ethernet/brocade/bna/bfa_ioc.c:3169:26: sparse: sparse: cast to restricted __be32
drivers/net/ethernet/brocade/bna/bfa_ioc.c:3177:26: sparse: sparse: cast to restricted __be32
drivers/net/ethernet/brocade/bna/bfa_ioc.c:3182:35: sparse: sparse: cast to restricted __be32
drivers/net/ethernet/brocade/bna/bfa_ioc.c: note: in included file:
drivers/net/ethernet/brocade/bna/bfa_ioc.h:55:34: sparse: sparse: cast from restricted __be32
drivers/net/ethernet/brocade/bna/bfa_ioc.h:56:34: sparse: sparse: cast from restricted __be32
drivers/net/ethernet/brocade/bna/bfa_ioc.h:65:22: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] al_len @@ got restricted __be32 [usertype] @@
drivers/net/ethernet/brocade/bna/bfa_ioc.h:65:22: sparse: expected unsigned int [usertype] al_len
drivers/net/ethernet/brocade/bna/bfa_ioc.h:65:22: sparse: got restricted __be32 [usertype]
drivers/net/ethernet/brocade/bna/bfa_ioc.h:55:34: sparse: sparse: cast from restricted __be32
drivers/net/ethernet/brocade/bna/bfa_ioc.h:56:34: sparse: sparse: cast from restricted __be32
drivers/net/ethernet/brocade/bna/bfa_ioc.h:65:22: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] al_len @@ got restricted __be32 [usertype] @@
drivers/net/ethernet/brocade/bna/bfa_ioc.h:65:22: sparse: expected unsigned int [usertype] al_len
drivers/net/ethernet/brocade/bna/bfa_ioc.h:65:22: sparse: got restricted __be32 [usertype]
drivers/net/ethernet/brocade/bna/bfa_ioc.h:55:34: sparse: sparse: cast from restricted __be32
drivers/net/ethernet/brocade/bna/bfa_ioc.h:56:34: sparse: sparse: cast from restricted __be32
drivers/net/ethernet/brocade/bna/bfa_ioc.h:65:22: sparse: sparse: incorrect type in assignment (different base types) @@ expected unsigned int [usertype] al_len @@ got restricted __be32 [usertype] @@
drivers/net/ethernet/brocade/bna/bfa_ioc.h:65:22: sparse: expected unsigned int [usertype] al_len
drivers/net/ethernet/brocade/bna/bfa_ioc.h:65:22: sparse: got restricted __be32 [usertype]
drivers/net/ethernet/brocade/bna/bfa_ioc.h:55:34: sparse: sparse: cast from restricted __be32
drivers/net/ethernet/brocade/bna/bfa_ioc.h:56:34: sparse: sparse: cast from restricted __be32

vim +1904 drivers/net/ethernet/brocade/bna/bfa_ioc.c

8b230ed8ec96c9 drivers/net/bna/bfa_ioc.c Rasesh Mody 2010-08-23 1891
8a891429d1879a drivers/net/bna/bfa_ioc.c Rasesh Mody 2010-08-25 1892 static void
8b230ed8ec96c9 drivers/net/bna/bfa_ioc.c Rasesh Mody 2010-08-23 1893 bfa_ioc_mbox_send(struct bfa_ioc *ioc, void *ioc_msg, int len)
8b230ed8ec96c9 drivers/net/bna/bfa_ioc.c Rasesh Mody 2010-08-23 1894 {
8b230ed8ec96c9 drivers/net/bna/bfa_ioc.c Rasesh Mody 2010-08-23 1895 u32 *msgp = (u32 *) ioc_msg;
8b230ed8ec96c9 drivers/net/bna/bfa_ioc.c Rasesh Mody 2010-08-23 1896 u32 i;
8b230ed8ec96c9 drivers/net/bna/bfa_ioc.c Rasesh Mody 2010-08-23 1897
8b230ed8ec96c9 drivers/net/bna/bfa_ioc.c Rasesh Mody 2010-08-23 1898 BUG_ON(!(len <= BFI_IOC_MSGLEN_MAX));
8b230ed8ec96c9 drivers/net/bna/bfa_ioc.c Rasesh Mody 2010-08-23 1899
8b230ed8ec96c9 drivers/net/bna/bfa_ioc.c Rasesh Mody 2010-08-23 1900 /*
8b230ed8ec96c9 drivers/net/bna/bfa_ioc.c Rasesh Mody 2010-08-23 1901 * first write msg to mailbox registers
8b230ed8ec96c9 drivers/net/bna/bfa_ioc.c Rasesh Mody 2010-08-23 1902 */
8b230ed8ec96c9 drivers/net/bna/bfa_ioc.c Rasesh Mody 2010-08-23 1903 for (i = 0; i < len / sizeof(u32); i++)
8b230ed8ec96c9 drivers/net/bna/bfa_ioc.c Rasesh Mody 2010-08-23 @1904 writel(cpu_to_le32(msgp[i]),
8b230ed8ec96c9 drivers/net/bna/bfa_ioc.c Rasesh Mody 2010-08-23 1905 ioc->ioc_regs.hfn_mbox + i * sizeof(u32));
8b230ed8ec96c9 drivers/net/bna/bfa_ioc.c Rasesh Mody 2010-08-23 1906
8b230ed8ec96c9 drivers/net/bna/bfa_ioc.c Rasesh Mody 2010-08-23 1907 for (; i < BFI_IOC_MSGLEN_MAX / sizeof(u32); i++)
8b230ed8ec96c9 drivers/net/bna/bfa_ioc.c Rasesh Mody 2010-08-23 1908 writel(0, ioc->ioc_regs.hfn_mbox + i * sizeof(u32));
8b230ed8ec96c9 drivers/net/bna/bfa_ioc.c Rasesh Mody 2010-08-23 1909
8b230ed8ec96c9 drivers/net/bna/bfa_ioc.c Rasesh Mody 2010-08-23 1910 /*
8b230ed8ec96c9 drivers/net/bna/bfa_ioc.c Rasesh Mody 2010-08-23 1911 * write 1 to mailbox CMD to trigger LPU event
8b230ed8ec96c9 drivers/net/bna/bfa_ioc.c Rasesh Mody 2010-08-23 1912 */
8b230ed8ec96c9 drivers/net/bna/bfa_ioc.c Rasesh Mody 2010-08-23 1913 writel(1, ioc->ioc_regs.hfn_mbox_cmd);
8b230ed8ec96c9 drivers/net/bna/bfa_ioc.c Rasesh Mody 2010-08-23 1914 (void) readl(ioc->ioc_regs.hfn_mbox_cmd);
8b230ed8ec96c9 drivers/net/bna/bfa_ioc.c Rasesh Mody 2010-08-23 1915 }
8b230ed8ec96c9 drivers/net/bna/bfa_ioc.c Rasesh Mody 2010-08-23 1916
8b230ed8ec96c9 drivers/net/bna/bfa_ioc.c Rasesh Mody 2010-08-23 1917 static void
8b230ed8ec96c9 drivers/net/bna/bfa_ioc.c Rasesh Mody 2010-08-23 1918 bfa_ioc_send_enable(struct bfa_ioc *ioc)
8b230ed8ec96c9 drivers/net/bna/bfa_ioc.c Rasesh Mody 2010-08-23 1919 {
8b230ed8ec96c9 drivers/net/bna/bfa_ioc.c Rasesh Mody 2010-08-23 1920 struct bfi_ioc_ctrl_req enable_req;
8b230ed8ec96c9 drivers/net/bna/bfa_ioc.c Rasesh Mody 2010-08-23 1921
8b230ed8ec96c9 drivers/net/bna/bfa_ioc.c Rasesh Mody 2010-08-23 1922 bfi_h2i_set(enable_req.mh, BFI_MC_IOC, BFI_IOC_H2I_ENABLE_REQ,
8b230ed8ec96c9 drivers/net/bna/bfa_ioc.c Rasesh Mody 2010-08-23 1923 bfa_ioc_portid(ioc));
078086f3c17fae drivers/net/ethernet/brocade/bna/bfa_ioc.c Rasesh Mody 2011-08-08 1924 enable_req.clscode = htons(ioc->clscode);
a5af83925363eb drivers/net/ethernet/brocade/bna/bfa_ioc.c Arnd Bergmann 2017-03-23 @1925 enable_req.rsvd = htons(0);
a5af83925363eb drivers/net/ethernet/brocade/bna/bfa_ioc.c Arnd Bergmann 2017-03-23 1926 /* overflow in 2106 */
a5af83925363eb drivers/net/ethernet/brocade/bna/bfa_ioc.c Arnd Bergmann 2017-03-23 1927 enable_req.tv_sec = ntohl(ktime_get_real_seconds());
8b230ed8ec96c9 drivers/net/bna/bfa_ioc.c Rasesh Mody 2010-08-23 1928 bfa_ioc_mbox_send(ioc, &enable_req, sizeof(struct bfi_ioc_ctrl_req));
8b230ed8ec96c9 drivers/net/bna/bfa_ioc.c Rasesh Mody 2010-08-23 1929 }
8b230ed8ec96c9 drivers/net/bna/bfa_ioc.c Rasesh Mody 2010-08-23 1930

:::::: The code at line 1904 was first introduced by commit
:::::: 8b230ed8ec96c933047dd0625cf95f739e4939a6 bna: Brocade 10Gb Ethernet device driver

:::::: TO: Rasesh Mody <rmody@xxxxxxxxxxx>
:::::: CC: David S. Miller <davem@xxxxxxxxxxxxx>

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