]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
spi: ftssp010_spi: Use to_ftssp010_spi() to ensure free correct address
authorAxel Lin <axel.lin@ingics.com>
Mon, 9 Feb 2015 07:11:09 +0000 (15:11 +0800)
committerJagannadha Sutradharudu Teki <jagannadh.teki@gmail.com>
Sun, 29 Mar 2015 20:09:20 +0000 (01:39 +0530)
Don't assume slave is always the first member of struct ftssp010_spi.
Use to_ftssp010_spi() to ensure free correct address in spi_free_slave().

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Reviewed-by: Jagannadha Sutradharudu Teki <jagannadh.teki@gmail.com>
drivers/spi/ftssp010_spi.c

index 267e4d83bd0ea0e51af933a010cb6345c67b87e8..c7d648047804d40e18f1e9e5762c8f30374615dc 100644 (file)
@@ -431,7 +431,9 @@ free_out:
 
 void spi_free_slave(struct spi_slave *slave)
 {
-       free(slave);
+       struct ftssp010_spi *chip = to_ftssp010_spi(slave);
+
+       free(chip);
 }
 
 int spi_claim_bus(struct spi_slave *slave)