Because the commit 8868c03f3ca5 ("spi: spi-mem: check if data buffers are on stack") introduced new check to warn when buffers on stack.
So use nor->bouncebuf to replace the stack variable for buf to fix the warning: ------------[ cut here ]------------ WARNING: CPU: 3 PID: 1 at drivers/spi/spi-mem.c:242 spi_mem_check_op+0x118/0x124 Modules linked in: CPU: 3 PID: 1 Comm: swapper/0 Not tainted 6.1.32-yocto-standard #1 Hardware name: NXP S32G399A-RDB3 (DT) pstate: 80000005 (Nzcv daif -PAN -UAO -TCO -DIT -SSBS BTYPE=--) pc : spi_mem_check_op+0x118/0x124 lr : spi_mem_check_op+0x88/0x124 sp : ffffffc00984b2d0 x29: ffffffc00984b2d0 x28: 0000000000000012 x27: ffffff8801034800 x26: ffffffc008e47f78 x25: ffffffc00901bed0 x24: ffffffc00984b358 x23: ffffffc008e47fb8 x22: ffffff8801069d80 x21: ffffffc00984b3c8 x20: ffffff8801035080 x19: ffffffc00984b660 x18: ffffffffffffffff x17: 2868746469777375 x16: 625f6b636568635f x15: ffffffc00984b250 x14: 0000000000000001 x13: 202928706f5f6b63 x12: 6568635f6d656d5f x11: 697073206c6c6163 x10: ffffffc0095a17e8 x9 : ffffffc0088991c8 x8 : 00000000ffffefff x7 : ffffffc0095a17e8 x6 : 80000000fffff000 x5 : 000000000000bff4 x4 : 0000000000000000 x3 : 0000000000000000 x2 : ffffffc00984b65f x1 : ffffffc00984c000 x0 : 0000000000000000 Call trace: spi_mem_check_op+0x118/0x124 spi_mem_exec_op+0xa0/0x49c spi_nor_macronix_octal_dtr_enable+0x80/0x170 spi_nor_init+0x94/0x14c spi_nor_scan+0x4e8/0xc70 spi_nor_probe+0x108/0x320 spi_mem_probe+0x74/0xc4 spi_probe+0x8c/0xec really_probe+0xc4/0x2e0 __driver_probe_device+0x80/0x120 driver_probe_device+0x48/0x120 __device_attach_driver+0xc0/0x13c bus_for_each_drv+0x84/0xe0 __device_attach+0xa4/0x1a0 device_initial_probe+0x1c/0x2c bus_probe_device+0xa4/0xb0 device_add+0x378/0x780 __spi_add_device+0x74/0x114 spi_add_device+0x68/0xa0 spi_register_controller+0x5b0/0xaa0 devm_spi_register_controller+0x54/0xb0 fsl_qspi_probe+0x260/0x390 platform_probe+0x70/0xcc really_probe+0xc4/0x2e0 __driver_probe_device+0x80/0x120 driver_probe_device+0x48/0x120 __driver_attach+0x9c/0x1a4 bus_for_each_dev+0x7c/0xe0 driver_attach+0x2c/0x40 bus_add_driver+0x15c/0x210 driver_register+0x80/0x13c __platform_driver_register+0x30/0x40 fsl_qspi_driver_init+0x24/0x30 do_one_initcall+0x78/0x2c0 kernel_init_freeable+0x224/0x294 kernel_init+0x30/0x140 ret_from_fork+0x10/0x20 ---[ end trace 0000000000000000 ]--- Signed-off-by: Zhantao Tang <zhantao.t...@windriver.com> --- drivers/mtd/spi-nor/macronix.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/mtd/spi-nor/macronix.c b/drivers/mtd/spi-nor/macronix.c index ce1c0d15d872..39e5fa95714b 100644 --- a/drivers/mtd/spi-nor/macronix.c +++ b/drivers/mtd/spi-nor/macronix.c @@ -36,15 +36,16 @@ static const struct spi_nor_fixups mx25l25635_fixups = { static int spi_nor_macronix_octal_dtr_enable(struct spi_nor *nor, bool enable) { struct spi_mem_op op; - u8 buf = 0xff; + u8 *buf = nor->bouncebuf; u8 addr_width = 4; int ret; + *buf = 0xff; op = (struct spi_mem_op) SPI_MEM_OP(SPI_MEM_OP_CMD(SPINOR_OP_RDCR2, 1), SPI_MEM_OP_ADDR(addr_width, 0x0, 1), SPI_MEM_OP_NO_DUMMY, - SPI_MEM_OP_DATA_IN(1, &buf, 1)); + SPI_MEM_OP_DATA_IN(1, buf, 1)); ret = spi_mem_exec_op(nor->spimem, &op); if (ret) { @@ -62,14 +63,14 @@ static int spi_nor_macronix_octal_dtr_enable(struct spi_nor *nor, bool enable) if (ret) return ret; - buf &= ~CR2_STR_OPI_EN; - buf |= CR2_DTR_OPI_EN; + *buf &= ~CR2_STR_OPI_EN; + *buf |= CR2_DTR_OPI_EN; op = (struct spi_mem_op) SPI_MEM_OP(SPI_MEM_OP_CMD(SPINOR_OP_WRCR2, 1), SPI_MEM_OP_ADDR(addr_width, 0x0, 1), SPI_MEM_OP_NO_DUMMY, - SPI_MEM_OP_DATA_OUT(1, &buf, 1)); + SPI_MEM_OP_DATA_OUT(1, buf, 1)); ret = spi_mem_exec_op(nor->spimem, &op); if (ret) { dev_err(nor->dev, "Failed to enable octal DTR mode\n"); -- 2.25.1
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#12716): https://lists.yoctoproject.org/g/linux-yocto/message/12716 Mute This Topic: https://lists.yoctoproject.org/mt/99398806/21656 Group Owner: linux-yocto+ow...@lists.yoctoproject.org Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-