[U-Boot] crash when doing `sf probe` multiple times due to API miscommunication

Mike Frysinger vapier at gentoo.org
Thu Dec 11 22:32:44 CET 2008


On Thursday 11 December 2008 15:52:25 Mike Frysinger wrote:
> the `sf probe` command does:
> static int do_spi_flash_probe(...)
> {
> 	...
> 	new = spi_flash_probe(bus, cs, speed, mode);
> 	if (flash)
> 		spi_flash_free(flash);
> 	flash = new;
> 	...
> }

oh, i left out one last function ...
void spi_flash_free(struct spi_flash *flash)
{
	spi_free_slave(flash->spi);
	free(flash);
}
and we see the wrong "free(flash)" ...

maybe if the spi_flash structure provided a pointer to its parent, then we 
could do "free(flash->parent)" ...
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20081211/38bbef3e/attachment.pgp 


More information about the U-Boot mailing list