aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/spi
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@ingics.com>2014-03-30 23:37:29 -0400
committerMark Brown <broonie@linaro.org>2014-04-14 12:19:39 -0400
commitc586feba880d78cab1882e1faee0395bba2b884f (patch)
treeab20dc7809326550ef3c79f2466b7c9ebe5970d7 /drivers/spi
parentc9eaa447e77efe77b7fa4c953bd62de8297fd6c5 (diff)
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>
Diffstat (limited to 'drivers/spi')
-rw-r--r--drivers/spi/spi-s3c24xx.c10
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)
183 183
184 /* allocate settings on the first call */ 184 /* allocate settings on the first call */
185 if (!cs) { 185 if (!cs) {
186 cs = kzalloc(sizeof(struct s3c24xx_spi_devstate), GFP_KERNEL); 186 cs = devm_kzalloc(&spi->dev,
187 sizeof(struct s3c24xx_spi_devstate),
188 GFP_KERNEL);
187 if (!cs) { 189 if (!cs) {
188 dev_err(&spi->dev, "no memory for controller state\n"); 190 dev_err(&spi->dev, "no memory for controller state\n");
189 return -ENOMEM; 191 return -ENOMEM;
@@ -209,11 +211,6 @@ static int s3c24xx_spi_setup(struct spi_device *spi)
209 return 0; 211 return 0;
210} 212}
211 213
212static void s3c24xx_spi_cleanup(struct spi_device *spi)
213{
214 kfree(spi->controller_state);
215}
216
217static inline unsigned int hw_txbyte(struct s3c24xx_spi *hw, int count) 214static inline unsigned int hw_txbyte(struct s3c24xx_spi *hw, int count)
218{ 215{
219 return hw->tx ? hw->tx[count] : 0; 216 return hw->tx ? hw->tx[count] : 0;
@@ -543,7 +540,6 @@ static int s3c24xx_spi_probe(struct platform_device *pdev)
543 hw->bitbang.txrx_bufs = s3c24xx_spi_txrx; 540 hw->bitbang.txrx_bufs = s3c24xx_spi_txrx;
544 541
545 hw->master->setup = s3c24xx_spi_setup; 542 hw->master->setup = s3c24xx_spi_setup;
546 hw->master->cleanup = s3c24xx_spi_cleanup;
547 543
548 dev_dbg(hw->dev, "bitbang at %p\n", &hw->bitbang); 544 dev_dbg(hw->dev, "bitbang at %p\n", &hw->bitbang);
549 545