Commit c63f5da0 authored by Axel Lin's avatar Axel Lin Committed by Mark Brown

spi: dw: Don't call kfree for memory allocated by devm_kzalloc

With devm_kzalloc, the memory is automatically freed when spi_device detach from
the bus.

Fixes: commit 43f627ac (spi: dw: fix memory leak on error path)
Signed-off-by: default avatarAxel Lin <axel.lin@ingics.com>
Acked-by: default avatarBaruch Siach <baruch@tkos.co.il>
Signed-off-by: default avatarMark Brown <broonie@linaro.org>
Cc: stabe@vger.kernel.org
parent 765ee709
......@@ -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);
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment