Commit 81a66446c319225c4a8f0c4c0d9cf4ee10f8c2b9

Authored by Axel Lin
Committed by Jagannadha Sutradharudu Teki
1 parent aa8306a90e

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>

Showing 1 changed file with 3 additions and 1 deletions Side-by-side Diff

drivers/spi/ftssp010_spi.c
... ... @@ -431,7 +431,9 @@
431 431  
432 432 void spi_free_slave(struct spi_slave *slave)
433 433 {
434   - free(slave);
  434 + struct ftssp010_spi *chip = to_ftssp010_spi(slave);
  435 +
  436 + free(chip);
435 437 }
436 438  
437 439 int spi_claim_bus(struct spi_slave *slave)