diff options
author | Axel Lin <axel.lin@ingics.com> | 2014-03-31 11:37:29 +0800 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2014-04-14 17:19:39 +0100 |
commit | c586feba880d78cab1882e1faee0395bba2b884f (patch) | |
tree | ab20dc7809326550ef3c79f2466b7c9ebe5970d7 | |
parent | c9eaa447e77efe77b7fa4c953bd62de8297fd6c5 (diff) | |
download | linux-c586feba880d78cab1882e1faee0395bba2b884f.tar.bz2 |
spi: s3c24xx: Convert to use devm_kzalloc
Simplify the cleanup code.
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Reviewed-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
-rw-r--r-- | drivers/spi/spi-s3c24xx.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/drivers/spi/spi-s3c24xx.c b/drivers/spi/spi-s3c24xx.c index bed23384dfab..6db14e53af17 100644 --- a/drivers/spi/spi-s3c24xx.c +++ b/drivers/spi/spi-s3c24xx.c @@ -183,7 +183,9 @@ static int s3c24xx_spi_setup(struct spi_device *spi) /* allocate settings on the first call */ 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) { dev_err(&spi->dev, "no memory for controller state\n"); return -ENOMEM; @@ -209,11 +211,6 @@ static int s3c24xx_spi_setup(struct spi_device *spi) 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) { return hw->tx ? hw->tx[count] : 0; @@ -543,7 +540,6 @@ static int s3c24xx_spi_probe(struct platform_device *pdev) hw->bitbang.txrx_bufs = s3c24xx_spi_txrx; hw->master->setup = s3c24xx_spi_setup; - hw->master->cleanup = s3c24xx_spi_cleanup; dev_dbg(hw->dev, "bitbang at %p\n", &hw->bitbang); |