diff options
author | Brad Bozarth <bflinux@yumbrad.com> | 2009-01-01 22:45:47 -0500 |
---|---|---|
committer | Wolfgang Denk <wd@denx.de> | 2009-01-24 01:57:40 +0100 |
commit | 68f8718df2ed4c2f43031407ccf6cfa81125dddc (patch) | |
tree | a375c69324a631741424cbaef3dfe46c5e8099ee /drivers/mtd | |
parent | ce82ff05388b5ddafdf6082ef0776cce72c40b1c (diff) | |
download | u-boot-imx-68f8718df2ed4c2f43031407ccf6cfa81125dddc.zip u-boot-imx-68f8718df2ed4c2f43031407ccf6cfa81125dddc.tar.gz u-boot-imx-68f8718df2ed4c2f43031407ccf6cfa81125dddc.tar.bz2 |
spi flash: fix crash due to spi flash miscommunication
Higher spi flash layers expect to be given back a pointer that was
malloced so that it can free the result, but the lower layers return
a pointer that is in the middle of the malloced memory. Reorder the
members of the lower spi structures so that things work out.
Signed-off-by: Brad Bozarth <bflinux@yumbrad.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Acked-by: Haavard Skinnemoen <haavard.skinnemoen@atmel.com>
Diffstat (limited to 'drivers/mtd')
-rw-r--r-- | drivers/mtd/spi/atmel.c | 3 | ||||
-rw-r--r-- | drivers/mtd/spi/stmicro.c | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/drivers/mtd/spi/atmel.c b/drivers/mtd/spi/atmel.c index 10fcf0c..a5f51ca 100644 --- a/drivers/mtd/spi/atmel.c +++ b/drivers/mtd/spi/atmel.c @@ -39,9 +39,10 @@ struct atmel_spi_flash_params { const char *name; }; +/* spi_flash needs to be first so upper layers can free() it */ struct atmel_spi_flash { - const struct atmel_spi_flash_params *params; struct spi_flash flash; + const struct atmel_spi_flash_params *params; }; static inline struct atmel_spi_flash * diff --git a/drivers/mtd/spi/stmicro.c b/drivers/mtd/spi/stmicro.c index 86324e4..e7dda91 100644 --- a/drivers/mtd/spi/stmicro.c +++ b/drivers/mtd/spi/stmicro.c @@ -64,9 +64,10 @@ struct stmicro_spi_flash_params { const char *name; }; +/* spi_flash needs to be first so upper layers can free() it */ struct stmicro_spi_flash { - const struct stmicro_spi_flash_params *params; struct spi_flash flash; + const struct stmicro_spi_flash_params *params; }; static inline struct stmicro_spi_flash *to_stmicro_spi_flash(struct spi_flash |