[Seems like I forgot to send this and it stayed in my Drafts folder. Anyway, fixed in v7] Hi Mason, On 21/05/20 04:27PM, masonccyang@xxxxxxxxxxx wrote: > > Hi Pratyush, > > Given cmd.nbytes a initial value & check it ! > > > > > [PATCH v5 01/19] spi: spi-mem: allow specifying whether an op is DTR or > not > > > > Each phase is given a separate 'dtr' field so mixed protocols like > > 4S-4D-4D can be supported. > > > > Signed-off-by: Pratyush Yadav <p.yadav@xxxxxx> > > --- > > drivers/spi/spi-mem.c | 3 +++ > > include/linux/spi/spi-mem.h | 8 ++++++++ > > 2 files changed, 11 insertions(+) > > > > diff --git a/drivers/spi/spi-mem.c b/drivers/spi/spi-mem.c > > index 9a86cc27fcc0..93e255287ab9 100644 > > --- a/drivers/spi/spi-mem.c > > +++ b/drivers/spi/spi-mem.c > > @@ -156,6 +156,9 @@ bool spi_mem_default_supports_op(struct spi_mem > *mem, > > op->data.dir == SPI_MEM_DATA_OUT)) > > return false; > > > > + if (op->cmd.dtr || op->addr.dtr || op->dummy.dtr || op->data.dtr) > > + return false; > > + > > + if (op->cmd.nbytes != 1) > + return false; Good catch. Will fix. > > return true; > > } > > EXPORT_SYMBOL_GPL(spi_mem_default_supports_op); > > > static int spi_mem_check_op(const struct spi_mem_op *op) > { > - if (!op->cmd.buswidth) > + if (!op->cmd.buswidth || op->cmd.nbytes < 1 || > op->cmd.nbytes > 2) > return -EINVAL; Will fix. > > > diff --git a/include/linux/spi/spi-mem.h b/include/linux/spi/spi-mem.h > > index af9ff2f0f1b2..e3dcb956bf61 100644 > > --- a/include/linux/spi/spi-mem.h > > +++ b/include/linux/spi/spi-mem.h > > #define SPI_MEM_OP_CMD(__opcode, __buswidth) \ > { \ > .buswidth = __buswidth, \ > .opcode = __opcode, \ > + .nbytes = 1, \ > } Will fix. Thanks. -- Regards, Pratyush Yadav Texas Instruments India ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/