Skip to content

Commit

Permalink
spi: dw: Don't call kfree for memory allocated by devm_kzalloc
Browse files Browse the repository at this point in the history
With devm_kzalloc, the memory is automatically freed when spi_device detach from
the bus.

Fixes: commit 43f627a (spi: dw: fix memory leak on error path)
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Mark Brown <broonie@linaro.org>
Cc: stabe@vger.kernel.org
  • Loading branch information
Axel Lin authored and Mark Brown committed Mar 28, 2014
1 parent 765ee70 commit c63f5da
Showing 1 changed file with 0 additions and 7 deletions.
7 changes: 0 additions & 7 deletions drivers/spi/spi-dw.c
Original file line number Diff line number Diff line change
Expand Up @@ -665,12 +665,6 @@ static int dw_spi_setup(struct spi_device *spi)
return 0;
}

static void dw_spi_cleanup(struct spi_device *spi)
{
struct chip_data *chip = spi_get_ctldata(spi);
kfree(chip);
}

static int init_queue(struct dw_spi *dws)
{
INIT_LIST_HEAD(&dws->queue);
Expand Down Expand Up @@ -800,7 +794,6 @@ int dw_spi_add_host(struct device *dev, struct dw_spi *dws)
master->bits_per_word_mask = SPI_BPW_MASK(8) | SPI_BPW_MASK(16);
master->bus_num = dws->bus_num;
master->num_chipselect = dws->num_cs;
master->cleanup = dw_spi_cleanup;
master->setup = dw_spi_setup;
master->transfer = dw_spi_transfer;
master->max_speed_hz = dws->max_freq;
Expand Down

0 comments on commit c63f5da

Please sign in to comment.