mtd: devices: m25p80: Make sure the buffer passed in op is DMA-able
authorBoris Brezillon <boris.brezillon@bootlin.com>
Mon, 17 Sep 2018 14:31:30 +0000 (16:31 +0200)
committerBoris Brezillon <boris.brezillon@bootlin.com>
Tue, 18 Sep 2018 08:17:48 +0000 (10:17 +0200)
commit4a3e85f2674cbfb81052059107d0165269778e2f
tree88e32db1e0460c11dda408086e7f3d9c1399ef43
parent85516a9881a31e2c7a8d10f4697f3adcccc7cef1
mtd: devices: m25p80: Make sure the buffer passed in op is DMA-able

As documented in spi-mem.h, spi_mem_op->data.buf.{in,out} must be
DMA-able, and commit 4120f8d158ef ("mtd: spi-nor: Use the spi_mem_xx()
API") failed to follow this rule as buffers passed to
->{read,write}_reg() are usually placed on the stack.

Fix that by allocating a scratch buffer and copying the data around.

Fixes: 4120f8d158ef ("mtd: spi-nor: Use the spi_mem_xx() API")
Reported-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
Tested-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Reviewed-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
drivers/mtd/devices/m25p80.c