Re: [PATCH v2 5/7] mtd: devices: m25p80: Use the spi-mem dirmap API

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/



[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux