public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] spi: ftssp010_spi: Use to_ftssp010_spi() to ensure free correct address
@ 2015-02-09  7:11 Axel Lin
  2015-02-17  8:46 ` Jagan Teki
  0 siblings, 1 reply; 2+ messages in thread
From: Axel Lin @ 2015-02-09  7:11 UTC (permalink / raw)
  To: u-boot

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>
---
 drivers/spi/ftssp010_spi.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/spi/ftssp010_spi.c b/drivers/spi/ftssp010_spi.c
index 267e4d8..c7d6480 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)
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [U-Boot] spi: ftssp010_spi: Use to_ftssp010_spi() to ensure free correct address
  2015-02-09  7:11 [U-Boot] spi: ftssp010_spi: Use to_ftssp010_spi() to ensure free correct address Axel Lin
@ 2015-02-17  8:46 ` Jagan Teki
  0 siblings, 0 replies; 2+ messages in thread
From: Jagan Teki @ 2015-02-17  8:46 UTC (permalink / raw)
  To: u-boot

On 9 February 2015 at 12:41, Axel Lin <axel.lin@ingics.com> wrote:
> 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>
> ---
>  drivers/spi/ftssp010_spi.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/spi/ftssp010_spi.c b/drivers/spi/ftssp010_spi.c
> index 267e4d8..c7d6480 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)
> --
> 1.9.1
>
>
>

Applied to u-boot-spi/master

thanks!
-- 
Jagan.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-02-17  8:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-09  7:11 [U-Boot] spi: ftssp010_spi: Use to_ftssp010_spi() to ensure free correct address Axel Lin
2015-02-17  8:46 ` Jagan Teki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox