drivers/hid/intel-ish-hid/ishtp/loader.c:172:8: error: incompatible pointer types passing '__le64 *' (aka 'unsigned long long *') to parameter of type 'dma_addr_t *' (aka 'unsigned int *')

kernel test robot
2024-05-20T05:07:34Z

tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: eb6a9339efeb6f3d2b5c86fdf2382cdc293eca2c
commit: 579a267e4617d705f6c795e5e755b01f1f87eff3 HID: intel-ish-hid: Implement loading firmware from host feature
date: 13 days ago
config: i386-buildonly-randconfig-005-20240520 (https://download.01.org/0day-ci/archive/20240520/202405201313.SAStVPrT-lkp@intel.com/config)
compiler: clang version 18.1.5 (https://github.com/llvm/llvm-project 617a15a9eac96088ae5e9134248d8236e34b91b1)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240520/202405201313.SAStVPrT-lkp@intel.com/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@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202405201313.SAStVPrT-lkp@intel.com/

All errors (new ones prefixed by >>):

>> drivers/hid/intel-ish-hid/ishtp/loader.c:172:8: error: incompatible pointer types passing '__le64 *' (aka 'unsigned long long *') to parameter of type 'dma_addr_t *' (aka 'unsigned int *') [-Werror,-Wincompatible-pointer-types]
172 | &fragment->fragment_tbl[i].ddr_adrs, GFP_KERNEL);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/dma-mapping.h:429:15: note: passing argument to parameter 'dma_handle' here
429 | dma_addr_t *dma_handle, gfp_t gfp)
| ^
drivers/hid/intel-ish-hid/ishtp/loader.c:207:2: error: call to undeclared function 'DEFINE_RAW_FLEX'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
207 | DEFINE_RAW_FLEX(struct loader_xfer_dma_fragment, fragment, fragment_tbl, FRAGMENT_MAX_NUM);
| ^
drivers/hid/intel-ish-hid/ishtp/loader.c:207:18: error: expected expression
207 | DEFINE_RAW_FLEX(struct loader_xfer_dma_fragment, fragment, fragment_tbl, FRAGMENT_MAX_NUM);
| ^
drivers/hid/intel-ish-hid/ishtp/loader.c:207:51: error: use of undeclared identifier 'fragment'
207 | DEFINE_RAW_FLEX(struct loader_xfer_dma_fragment, fragment, fragment_tbl, FRAGMENT_MAX_NUM);
| ^
drivers/hid/intel-ish-hid/ishtp/loader.c:207:61: error: use of undeclared identifier 'fragment_tbl'
207 | DEFINE_RAW_FLEX(struct loader_xfer_dma_fragment, fragment, fragment_tbl, FRAGMENT_MAX_NUM);
| ^
drivers/hid/intel-ish-hid/ishtp/loader.c:229:2: error: use of undeclared identifier 'fragment'
229 | fragment->fragment.header.command = LOADER_CMD_XFER_FRAGMENT;
| ^
drivers/hid/intel-ish-hid/ishtp/loader.c:230:2: error: use of undeclared identifier 'fragment'
230 | fragment->fragment.xfer_mode = LOADER_XFER_MODE_DMA;
| ^
drivers/hid/intel-ish-hid/ishtp/loader.c:231:2: error: use of undeclared identifier 'fragment'
231 | fragment->fragment.is_last = 1;
| ^
drivers/hid/intel-ish-hid/ishtp/loader.c:232:2: error: use of undeclared identifier 'fragment'
232 | fragment->fragment.size = ish_fw->size;
| ^
drivers/hid/intel-ish-hid/ishtp/loader.c:236:2: error: use of undeclared identifier 'fragment'
236 | fragment->fragment_cnt = DIV_ROUND_UP(ish_fw->size, fragment_size);
| ^
drivers/hid/intel-ish-hid/ishtp/loader.c:238:37: error: use of undeclared identifier 'fragment'
238 | rv = prepare_dma_bufs(dev, ish_fw, fragment, dma_bufs, fragment_size);
| ^
drivers/hid/intel-ish-hid/ishtp/loader.c:258:46: error: use of undeclared identifier 'fragment'
258 | struct_size(fragment, fragment_tbl, fragment->fragment_cnt),
| ^
drivers/hid/intel-ish-hid/ishtp/loader.c:257:29: error: use of undeclared identifier 'fragment'
257 | rv = loader_xfer_cmd(dev, fragment,
| ^
drivers/hid/intel-ish-hid/ishtp/loader.c:273:24: error: use of undeclared identifier 'fragment'
273 | release_dma_bufs(dev, fragment, dma_bufs, fragment_size);
| ^
14 errors generated.

vim +172 drivers/hid/intel-ish-hid/ishtp/loader.c

151
152 /**
153 * prepare_dma_bufs() - Prepare the DMA buffer for transferring firmware fragments
154 * @dev: The ISHTP device
155 * @ish_fw: The ISH firmware
156 * @fragment: The ISHTP firmware fragment descriptor
157 * @dma_bufs: The array of DMA fragment buffers
158 * @fragment_size: The size of a single DMA fragment
159 *
160 * Return: 0 on success, negative error code on failure
161 */
162 static int prepare_dma_bufs(struct ishtp_device *dev,
163 const struct firmware *ish_fw,
164 struct loader_xfer_dma_fragment *fragment,
165 void **dma_bufs, u32 fragment_size)
166 {
167 u32 offset = 0;
168 int i;
169
170 for (i = 0; i < fragment->fragment_cnt && offset < ish_fw->size; i++) {
171 dma_bufs[i] = dma_alloc_coherent(dev->devc, fragment_size,
> 172 &fragment->fragment_tbl[i].ddr_adrs, GFP_KERNEL);
173 if (!dma_bufs[i])
174 return -ENOMEM;
175
176 fragment->fragment_tbl[i].length = clamp(ish_fw->size - offset, 0, fragment_size);
177 fragment->fragment_tbl[i].fw_off = offset;
178 memcpy(dma_bufs[i], ish_fw->data + offset, fragment->fragment_tbl[i].length);
179 clflush_cache_range(dma_bufs[i], fragment_size);
180
181 offset += fragment->fragment_tbl[i].length;
182 }
183
184 return 0;
185 }
186

--
0-DAY CI Kernel Test Service