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

spi: s3c24xx: Convert to use devm_kzalloc

Simplify the cleanup code.
Signed-off-by: default avatarAxel Lin <axel.lin@ingics.com>
Reviewed-by: default avatarJingoo Han <jg1.han@samsung.com>
Signed-off-by: default avatarMark Brown <broonie@linaro.org>
parent c9eaa447
...@@ -183,7 +183,9 @@ static int s3c24xx_spi_setup(struct spi_device *spi) ...@@ -183,7 +183,9 @@ static int s3c24xx_spi_setup(struct spi_device *spi)
/* allocate settings on the first call */ /* allocate settings on the first call */
if (!cs) { if (!cs) {
cs = kzalloc(sizeof(struct s3c24xx_spi_devstate), GFP_KERNEL); cs = devm_kzalloc(&spi->dev,
sizeof(struct s3c24xx_spi_devstate),
GFP_KERNEL);
if (!cs) { if (!cs) {
dev_err(&spi->dev, "no memory for controller state\n"); dev_err(&spi->dev, "no memory for controller state\n");
return -ENOMEM; return -ENOMEM;
...@@ -209,11 +211,6 @@ static int s3c24xx_spi_setup(struct spi_device *spi) ...@@ -209,11 +211,6 @@ static int s3c24xx_spi_setup(struct spi_device *spi)
return 0; return 0;
} }
static void s3c24xx_spi_cleanup(struct spi_device *spi)
{
kfree(spi->controller_state);
}
static inline unsigned int hw_txbyte(struct s3c24xx_spi *hw, int count) static inline unsigned int hw_txbyte(struct s3c24xx_spi *hw, int count)
{ {
return hw->tx ? hw->tx[count] : 0; return hw->tx ? hw->tx[count] : 0;
...@@ -543,7 +540,6 @@ static int s3c24xx_spi_probe(struct platform_device *pdev) ...@@ -543,7 +540,6 @@ static int s3c24xx_spi_probe(struct platform_device *pdev)
hw->bitbang.txrx_bufs = s3c24xx_spi_txrx; hw->bitbang.txrx_bufs = s3c24xx_spi_txrx;
hw->master->setup = s3c24xx_spi_setup; hw->master->setup = s3c24xx_spi_setup;
hw->master->cleanup = s3c24xx_spi_cleanup;
dev_dbg(hw->dev, "bitbang at %p\n", &hw->bitbang); dev_dbg(hw->dev, "bitbang at %p\n", &hw->bitbang);
......
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