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 <axel.lin@ingics.com>
Reviewed-by: Jagannadha Sutradharudu Teki <jagannadh.teki@gmail.com>
This commit is contained in:
Axel Lin 2015-02-09 15:11:09 +08:00 committed by Jagannadha Sutradharudu Teki
parent aa8306a90e
commit 81a66446c3

View 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)