From: Axel Lin Date: Mon, 9 Feb 2015 07:11:09 +0000 (+0800) Subject: spi: ftssp010_spi: Use to_ftssp010_spi() to ensure free correct address X-Git-Url: http://git.dujemihanovic.xyz/?a=commitdiff_plain;h=81a66446c319225c4a8f0c4c0d9cf4ee10f8c2b9;p=u-boot.git spi: ftssp010_spi: Use to_ftssp010_spi() to ensure free correct address 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 Reviewed-by: Jagannadha Sutradharudu Teki --- diff --git a/drivers/spi/ftssp010_spi.c b/drivers/spi/ftssp010_spi.c index 267e4d83bd..c7d6480478 100644 --- a/drivers/spi/ftssp010_spi.c +++ b/drivers/spi/ftssp010_spi.c @@ -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)