On Tue, 18 Sep 2018 10:59:17 +0300 Jarkko Nikula <jarkko.nikula@xxxxxxxxxxxxxxx> wrote: > On 09/17/2018 05:31 PM, Boris Brezillon wrote: > > 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@xxxxxxxxxxxxxxx> > > Cc: <stable@xxxxxxxxxxxxxxx> > > Signed-off-by: Boris Brezillon <boris.brezillon@xxxxxxxxxxx> > > --- > > Note that the ->{read,write}() path is still buggy since nothing > > guarantees that buffers passed by the MTD layer to the SPI NOR layer > > are DMA-able, but this is a long-standing issue which we'll have to > > address at the spi-nor level (this layer can choose the bounce buffer > > size based on nor->page_size). > > > > Changes in v2: > > - Copy the data from scratchbuf in the ->read_reg() path > > --- > > drivers/mtd/devices/m25p80.c | 26 +++++++++++++++++++++++--- > > 1 file changed, 23 insertions(+), 3 deletions(-) > > > Tested-by: Jarkko Nikula <jarkko.nikula@xxxxxxxxxxxxxxx> > Reviewed-by: Jarkko Nikula <jarkko.nikula@xxxxxxxxxxxxxxx> Queued to mtd/master. Thanks for testing and reviewing the patch. Regards, Boris