m25p80 enhance patches
cover m25p80 enhance patches
Re: [PATCH 3/3] [MTD] m25p80.c
In reply to a message not in the archiveQuoted 1 line · Chen Gong
Signed-off-by Chen Gong <[email protected]>
Changelog entry for this one?
Signature · 1 line
dwmw2
Re: [PATCH 3/3] [MTD] m25p80.c
In reply to a message not in the archiveReview static struct flash_info *__devinit jedec_probe(struct spi_device *spi) · line 556
Quoted 8 lines · Chen Gong
(quoted diff) +1
-0@@ -547,6 +550,7 @@ static struct flash_info *__devinit jedec_probe(struct spi_device *spi) u8 code = OPCODE_RDID; u8 id[3]; u32 jedec; + u16 ext_jedec; struct flash_info *info; /* JEDEC also defines an optional "extended device information"
* string for after vendor-specific data, after the three bytes
* we use here. Supporting some chips might require using it.
*/
tmp = spi_write_then_read(spi, &code, 1, id, 3);
if (tmp < 0) {
DEBUG(MTD_DEBUG_LEVEL0, "%s: error %d reading JEDEC ID\n",
spi->dev.bus_id, tmp);
return NULL;
}
jedec = id[0];
jedec = jedec << 8;
jedec |= id[1];Review
Quoted 5 lines
jedec = jedec << 8; jedec |= id[2];(quoted diff) +2
-0+ ext_jedec = id[3] << 8 | id[4]; +
You're trying to read off the end of the id[] array, which has only three elements. And you didn't ask spi_write_then_read() to read that many bytes _anyway_. And if you did... would it fail on chips which don't have the extended device information?
Please test and send a fix, since this is already in the git tree.
Signature · 2 lines
David Woodhouse Open Source Technology Centre [email protected] Intel Corporation
Re: [PATCH 3/3] [MTD] m25p80.c
2008/9/15 David Woodhouse <[email protected]>:
Quoted 24 lines · Chen Gong
Review static struct flash_info *__devinit jedec_probe(struct spi_device *spi) · line 556
Quoted 8 lines
(quoted diff) +1
-0@@ -547,6 +550,7 @@ static struct flash_info *__devinit jedec_probe(struct spi_device *spi) u8 code = OPCODE_RDID; u8 id[3]; u32 jedec; + u16 ext_jedec; struct flash_info *info; /* JEDEC also defines an optional "extended device information"* string for after vendor-specific data, after the three bytes * we use here. Supporting some chips might require using it. */ tmp = spi_write_then_read(spi, &code, 1, id, 3); if (tmp < 0) { DEBUG(MTD_DEBUG_LEVEL0, "%s: error %d reading JEDEC ID\n", spi->dev.bus_id, tmp); return NULL; } jedec = id[0]; jedec = jedec << 8; jedec |= id[1];Quoted 3 lines
jedec = jedec << 8; jedec |= id[2];
Quoted 8 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+ ext_jedec = id[3] << 8 | id[4]; +You're trying to read off the end of the id[] array, which has only three elements. And you didn't ask
spi_write_then_read()to read that many bytes _anyway_. And if you did... would it fail on chips which don't have the extended device information?
Sorry for late. Last day is Mid-autumn Festival in our Country. We have a nice holiday.
It is a stupid error that I forget to fix it from my branch. I will send a new patch
to fix it soon.
Quoted 11 lines
Please test and send a fix, since this is already in the git tree.
--
David Woodhouse Open Source Technology Centre
[email protected] Intel Corporation______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/