[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202202221129.mkw1pRTe-lkp@intel.com>
Date: Tue, 22 Feb 2022 12:07:26 +0800
From: kernel test robot <lkp@...el.com>
To: Felix Fietkau <nbd@....name>
Cc: kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org
Subject: [nbd168-wireless:mtk-flow-offload 3/14]
drivers/net/ethernet/mediatek/mtk_wed.c:150:36: sparse: sparse: incorrect
type in assignment (different base types)
tree: https://github.com/nbd168/wireless mtk-flow-offload
head: c5c9c022de79aa26f88a358954a868d8bbc2af11
commit: 3ca98adede31d2c6cb6e88a1fbd250deeac19d28 [3/14] net: ethernet: mtk_eth_soc: add support for Wireless Ethernet Dispatch (WED)
config: h8300-randconfig-s031-20220221 (https://download.01.org/0day-ci/archive/20220222/202202221129.mkw1pRTe-lkp@intel.com/config)
compiler: h8300-linux-gcc (GCC) 11.2.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-dirty
# https://github.com/nbd168/wireless/commit/3ca98adede31d2c6cb6e88a1fbd250deeac19d28
git remote add nbd168-wireless https://github.com/nbd168/wireless
git fetch --no-tags nbd168-wireless mtk-flow-offload
git checkout 3ca98adede31d2c6cb6e88a1fbd250deeac19d28
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=h8300 SHELL=/bin/bash drivers/net/ethernet/mediatek/
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>
sparse warnings: (new ones prefixed by >>)
>> drivers/net/ethernet/mediatek/mtk_wed.c:150:36: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __le32 [usertype] buf0 @@ got unsigned int [assigned] [usertype] buf_phys @@
drivers/net/ethernet/mediatek/mtk_wed.c:150:36: sparse: expected restricted __le32 [usertype] buf0
drivers/net/ethernet/mediatek/mtk_wed.c:150:36: sparse: got unsigned int [assigned] [usertype] buf_phys
>> drivers/net/ethernet/mediatek/mtk_wed.c:151:36: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __le32 [usertype] buf1 @@ got unsigned int @@
drivers/net/ethernet/mediatek/mtk_wed.c:151:36: sparse: expected restricted __le32 [usertype] buf1
drivers/net/ethernet/mediatek/mtk_wed.c:151:36: sparse: got unsigned int
>> drivers/net/ethernet/mediatek/mtk_wed.c:152:36: sparse: sparse: incorrect type in assignment (different base types) @@ expected restricted __le32 [usertype] ctrl @@ got unsigned long @@
drivers/net/ethernet/mediatek/mtk_wed.c:152:36: sparse: expected restricted __le32 [usertype] ctrl
drivers/net/ethernet/mediatek/mtk_wed.c:152:36: sparse: got unsigned long
>> drivers/net/ethernet/mediatek/mtk_wed.c:191:17: sparse: sparse: incorrect type in argument 2 (different base types) @@ expected unsigned int [usertype] addr @@ got restricted __le32 [usertype] buf0 @@
drivers/net/ethernet/mediatek/mtk_wed.c:191:17: sparse: expected unsigned int [usertype] addr
drivers/net/ethernet/mediatek/mtk_wed.c:191:17: sparse: got restricted __le32 [usertype] buf0
drivers/net/ethernet/mediatek/mtk_wed.c: note: in included file (through include/linux/scatterlist.h, include/linux/dma-mapping.h):
arch/h8300/include/asm/io.h:26:18: sparse: sparse: cast removes address space '__iomem' of expression
arch/h8300/include/asm/io.h:26:18: sparse: sparse: cast removes address space '__iomem' of expression
arch/h8300/include/asm/io.h:44:11: sparse: sparse: cast removes address space '__iomem' of expression
arch/h8300/include/asm/io.h:44:11: sparse: sparse: cast removes address space '__iomem' of expression
arch/h8300/include/asm/io.h:44:11: sparse: sparse: cast removes address space '__iomem' of expression
arch/h8300/include/asm/io.h:44:11: sparse: sparse: cast removes address space '__iomem' of expression
arch/h8300/include/asm/io.h:44:11: sparse: sparse: cast removes address space '__iomem' of expression
arch/h8300/include/asm/io.h:26:18: sparse: sparse: cast removes address space '__iomem' of expression
arch/h8300/include/asm/io.h:26:18: sparse: sparse: cast removes address space '__iomem' of expression
arch/h8300/include/asm/io.h:44:11: sparse: sparse: cast removes address space '__iomem' of expression
arch/h8300/include/asm/io.h:44:11: sparse: sparse: cast removes address space '__iomem' of expression
arch/h8300/include/asm/io.h:44:11: sparse: sparse: cast removes address space '__iomem' of expression
arch/h8300/include/asm/io.h:44:11: sparse: sparse: cast removes address space '__iomem' of expression
arch/h8300/include/asm/io.h:44:11: sparse: sparse: cast removes address space '__iomem' of expression
arch/h8300/include/asm/io.h:44:11: sparse: sparse: cast removes address space '__iomem' of expression
arch/h8300/include/asm/io.h:44:11: sparse: sparse: cast removes address space '__iomem' of expression
arch/h8300/include/asm/io.h:44:11: sparse: sparse: cast removes address space '__iomem' of expression
arch/h8300/include/asm/io.h:44:11: sparse: sparse: cast removes address space '__iomem' of expression
arch/h8300/include/asm/io.h:44:11: sparse: sparse: cast removes address space '__iomem' of expression
arch/h8300/include/asm/io.h:26:18: sparse: sparse: cast removes address space '__iomem' of expression
arch/h8300/include/asm/io.h:26:18: sparse: sparse: cast removes address space '__iomem' of expression
vim +150 drivers/net/ethernet/mediatek/mtk_wed.c
91
92 static int
93 mtk_wed_buffer_alloc(struct mtk_wed_device *dev)
94 {
95 struct mtk_wdma_desc *desc;
96 dma_addr_t desc_phys;
97 void **page_list;
98 int token = dev->wlan.token_start;
99 int ring_size;
100 int n_pages;
101 int i, page_idx;
102
103 ring_size = dev->wlan.nbuf & ~(MTK_WED_BUF_PER_PAGE - 1);
104 n_pages = ring_size / MTK_WED_BUF_PER_PAGE;
105
106 page_list = kcalloc(n_pages, sizeof(*page_list), GFP_KERNEL);
107 if (!page_list)
108 return -ENOMEM;
109
110 dev->buf_ring.size = ring_size;
111 dev->buf_ring.pages = page_list;
112
113 desc = dma_alloc_coherent(dev->hw->dev, ring_size * sizeof(*desc),
114 &desc_phys, GFP_KERNEL);
115 if (!desc)
116 return -ENOMEM;
117
118 dev->buf_ring.desc = desc;
119 dev->buf_ring.desc_phys = desc_phys;
120
121 for (i = 0, page_idx = 0; i < ring_size; i += MTK_WED_BUF_PER_PAGE) {
122 dma_addr_t page_phys, buf_phys;
123 struct page *page;
124 void *buf;
125 int s;
126
127 page = __dev_alloc_pages(GFP_KERNEL, 0);
128 if (!page)
129 return -ENOMEM;
130
131 page_phys = dma_map_page(dev->hw->dev, page, 0, PAGE_SIZE,
132 DMA_BIDIRECTIONAL);
133 if (dma_mapping_error(dev->hw->dev, page_phys)) {
134 __free_page(page);
135 return -ENOMEM;
136 }
137
138 page_list[page_idx++] = page;
139 dma_sync_single_for_cpu(dev->hw->dev, page_phys, PAGE_SIZE,
140 DMA_BIDIRECTIONAL);
141
142 buf = page_to_virt(page);
143 buf_phys = page_phys;
144
145 for (s = 0; s < MTK_WED_BUF_PER_PAGE; s++) {
146 u32 txd_size;
147
148 txd_size = dev->wlan.init_buf(buf, buf_phys, token++);
149
> 150 desc->buf0 = buf_phys;
> 151 desc->buf1 = buf_phys + txd_size;
> 152 desc->ctrl = FIELD_PREP(MTK_WDMA_DESC_CTRL_LEN0,
153 txd_size) |
154 FIELD_PREP(MTK_WDMA_DESC_CTRL_LEN1,
155 MTK_WED_BUF_SIZE - txd_size) |
156 MTK_WDMA_DESC_CTRL_LAST_SEG1;
157 desc->info = 0;
158 desc++;
159
160 buf += MTK_WED_BUF_SIZE;
161 buf_phys += MTK_WED_BUF_SIZE;
162 }
163
164 dma_sync_single_for_device(dev->hw->dev, page_phys, PAGE_SIZE,
165 DMA_BIDIRECTIONAL);
166 }
167
168 return 0;
169 }
170
171 static void
172 mtk_wed_free_buffer(struct mtk_wed_device *dev)
173 {
174 struct mtk_wdma_desc *desc = dev->buf_ring.desc;
175 void **page_list = dev->buf_ring.pages;
176 int page_idx;
177 int i;
178
179 if (!page_list)
180 return;
181
182 if (!desc)
183 goto free_pagelist;
184
185 for (i = 0, page_idx = 0; i < dev->buf_ring.size; i += MTK_WED_BUF_PER_PAGE) {
186 void *page = page_list[page_idx++];
187
188 if (!page)
189 break;
190
> 191 dma_unmap_page(dev->hw->dev, desc[i].buf0,
192 PAGE_SIZE, DMA_BIDIRECTIONAL);
193 __free_page(page);
194 }
195
196 dma_free_coherent(dev->hw->dev, dev->buf_ring.size * sizeof(*desc),
197 desc, dev->buf_ring.desc_phys);
198
199 free_pagelist:
200 kfree(page_list);
201 }
202
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Powered by blists - more mailing lists