Re: [PATCH 1/2] mtd: mtk-quadspi: add support for DMA reading

From: kbuild test robot
Date: Tue Nov 12 2019 - 02:29:55 EST


Hi Chuanhong,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on arm-soc/for-next]
[cannot apply to v5.4-rc7 next-20191111]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url: https://github.com/0day-ci/linux/commits/Chuanhong-Guo/mtd-mtk-quadspi-add-support-for-DMA-reading/20191112-145019
base: https://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc.git for-next
config: sparc-allyesconfig (attached as .config)
compiler: sparc64-linux-gcc (GCC) 7.4.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=7.4.0 make.cross ARCH=sparc

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

All warnings (new ones prefixed by >>):

drivers/mtd/spi-nor/mtk-quadspi.c: In function 'mtk_nor_read_dma_bounce':
>> drivers/mtd/spi-nor/mtk-quadspi.c:349:22: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
mem_unaligned_len = (u32)buf % MTK_NOR_DMA_ALIGN;
^
drivers/mtd/spi-nor/mtk-quadspi.c: In function 'mtk_nor_read':
drivers/mtd/spi-nor/mtk-quadspi.c:369:6: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
(u32)buffer % MTK_NOR_DMA_ALIGN || from % MTK_NOR_DMA_ALIGN)
^

vim +349 drivers/mtd/spi-nor/mtk-quadspi.c

330
331 static ssize_t mtk_nor_read_dma_bounce(struct mtk_nor *mtk_nor, loff_t from,
332 size_t length, u_char *buffer)
333 {
334 ssize_t nor_unaligned_len = from % MTK_NOR_DMA_ALIGN;
335 loff_t read_from = from & ~(MTK_NOR_DMA_ALIGN - 1);
336 ssize_t read_len;
337 u_char *buf;
338 u_char *bouncebuf;
339 size_t mem_unaligned_len;
340
341 if (length > MTK_NOR_MAX_BBUF_READ)
342 length = MTK_NOR_MAX_BBUF_READ;
343 read_len = length + nor_unaligned_len + MTK_NOR_DMA_ALIGN;
344
345 buf = kmalloc(read_len + MTK_NOR_DMA_ALIGN, GFP_KERNEL);
346 if (!buf)
347 return -ENOMEM;
348
> 349 mem_unaligned_len = (u32)buf % MTK_NOR_DMA_ALIGN;
350 bouncebuf = (buf + MTK_NOR_DMA_ALIGN) - mem_unaligned_len;
351
352 read_len = mtk_nor_read_dma(mtk_nor, read_from, read_len, bouncebuf);
353 if (read_len > 0)
354 memcpy(buffer, bouncebuf + nor_unaligned_len, length);
355
356 kfree(buf);
357 return length;
358 }
359

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx Intel Corporation

Attachment: .config.gz
Description: application/gzip