Re: [PATCH] fpga: dfl: afu: use kzalloc_obj over kzalloc with sizeof
kernel test robot <[email protected]> Wed, 13 May 2026 19:07:09 +0800
| Newsgroups | org.kernel.vger.linux-fpga,dev.linux.lists.llvm,dev.linux.lists.oe-kbuild-all,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
Hi Mayur, kernel test robot noticed the following build errors: [auto build test ERROR on linus/master] [also build test ERROR on v7.1-rc3 next-20260508] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Mayur-Kumar/fpga-dfl-afu-use-kzalloc_obj-over-kzalloc-with-sizeof/20260513-141558 base: linus/master patch link: https://lore.kernel.org/r/20260511181240.223224-1-kmayur809%40gmail.com patch subject: [PATCH] fpga: dfl: afu: use kzalloc_obj over kzalloc with sizeof config: i386-buildonly-randconfig-004-20260513 (https://download.01.org/0day-ci/archive/20260513/[email protected]/config) compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260513/[email protected]/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 <[email protected]> | Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/ All errors (new ones prefixed by >>): >> drivers/fpga/dfl-afu-dma-region.c:319:9: error: incompatible pointer types assigning to 'struct dfl_afu_dma_region *' from 'typeof (region) *' (aka 'struct dfl_afu_dma_region **'); dereference with * [-Werror,-Wincompatible-pointer-types] 319 | region = kzalloc_obj(region, GFP_KERNEL); | ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | *( ) 1 error generated. vim +319 drivers/fpga/dfl-afu-dma-region.c 289 290 /** 291 * afu_dma_map_region - map memory region for dma 292 * @fdata: feature dev data 293 * @user_addr: address of the memory region 294 * @length: size of the memory region 295 * @iova: pointer of iova address 296 * 297 * Map memory region defined by @user_addr and @length, and return dma address 298 * of the memory region via @iova. 299 * Return 0 for success, otherwise error code. 300 */ 301 int afu_dma_map_region(struct dfl_feature_dev_data *fdata, 302 u64 user_addr, u64 length, u64 *iova) 303 { 304 struct device *dev = &fdata->dev->dev; 305 struct dfl_afu_dma_region *region; 306 int ret; 307 308 /* 309 * Check Inputs, only accept page-aligned user memory region with 310 * valid length. 311 */ 312 if (!PAGE_ALIGNED(user_addr) || !PAGE_ALIGNED(length) || !length) 313 return -EINVAL; 314 315 /* Check overflow */ 316 if (user_addr + length < user_addr) 317 return -EINVAL; 318 > 319 region = kzalloc_obj(region, GFP_KERNEL); 320 if (!region) 321 return -ENOMEM; 322 323 region->user_addr = user_addr; 324 region->length = length; 325 326 /* Pin the user memory region */ 327 ret = afu_dma_pin_pages(fdata, region); 328 if (ret) { 329 dev_err(dev, "failed to pin memory region\n"); 330 goto free_region; 331 } 332 333 /* Only accept continuous pages, return error else */ 334 if (!afu_dma_check_continuous_pages(region)) { 335 dev_err(dev, "pages are not continuous\n"); 336 ret = -EINVAL; 337 goto unpin_pages; 338 } 339 340 /* As pages are continuous then start to do DMA mapping */ 341 region->iova = dma_map_page(dfl_fpga_fdata_to_parent(fdata), 342 region->pages[0], 0, 343 region->length, 344 DMA_BIDIRECTIONAL); 345 if (dma_mapping_error(dfl_fpga_fdata_to_parent(fdata), region->iova)) { 346 dev_err(dev, "failed to map for dma\n"); 347 ret = -EFAULT; 348 goto unpin_pages; 349 } 350 351 *iova = region->iova; 352 353 mutex_lock(&fdata->lock); 354 ret = afu_dma_region_add(fdata, region); 355 mutex_unlock(&fdata->lock); 356 if (ret) { 357 dev_err(dev, "failed to add dma region\n"); 358 goto unmap_dma; 359 } 360 361 return 0; 362 363 unmap_dma: 364 dma_unmap_page(dfl_fpga_fdata_to_parent(fdata), 365 region->iova, region->length, DMA_BIDIRECTIONAL); 366 unpin_pages: 367 afu_dma_unpin_pages(fdata, region); 368 free_region: 369 kfree(region); 370 return ret; 371 } 372 -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki