On Wed, 31 Oct 2018 10:28:04 +0000 Yogesh Narayan Gaur <yogeshnarayan.gaur@xxxxxxx> wrote: > > +static int m25p_create_read_dirmap(struct m25p *flash) { > > + struct spi_nor *nor = &flash->spi_nor; > > + struct spi_mem_dirmap_info info = { > > + .op_tmpl = SPI_MEM_OP(SPI_MEM_OP_CMD(nor- > > >read_opcode, 1), > > + SPI_MEM_OP_ADDR(nor->addr_width, 0, 1), > > + SPI_MEM_OP_DUMMY(nor->read_dummy, > > 1), > > + SPI_MEM_OP_DATA_IN(0, NULL, 1)), > > + .offset = 0, > > + .length = flash->spi_nor.mtd.size, > > I want to understand the sequence of calling up of this routine from drivers/mtd/spi-nor/spi-nor.c file. > Because till point of JedecID read and SFDP command read mtd.size is not being populated and having value as 0. This would make length as 0. When the dirmap is created mtd->size has been initialized already. But you're right, nor->read() might be called before the read dirmap has been created (SFDP read), which will lead to a NULL pointer exception. > > Did these read follow different path? Nope.