diff options
author | Sachin Kamat <sachin.kamat@linaro.org> | 2013-03-14 06:07:02 -0400 |
---|---|---|
committer | David Woodhouse <David.Woodhouse@intel.com> | 2013-04-05 08:20:05 -0400 |
commit | b60c7243863fd2a5059d2c3137ed31b797cd7848 (patch) | |
tree | 695560a103bf837d7cb0afe5aba86b4f896214be /drivers/mtd | |
parent | c4f8cde8343ace075fb3dae2d5bc796cdfaffbfd (diff) |
mtd: gpio: Use devm_kzalloc()
devm_kzalloc() is device managed and makes cleanup simpler.
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers/mtd')
-rw-r--r-- | drivers/mtd/nand/gpio.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/drivers/mtd/nand/gpio.c b/drivers/mtd/nand/gpio.c index e789e3f51710..0cc1394cbeb0 100644 --- a/drivers/mtd/nand/gpio.c +++ b/drivers/mtd/nand/gpio.c | |||
@@ -259,8 +259,6 @@ static int gpio_nand_remove(struct platform_device *dev) | |||
259 | if (gpio_is_valid(gpiomtd->plat.gpio_rdy)) | 259 | if (gpio_is_valid(gpiomtd->plat.gpio_rdy)) |
260 | gpio_free(gpiomtd->plat.gpio_rdy); | 260 | gpio_free(gpiomtd->plat.gpio_rdy); |
261 | 261 | ||
262 | kfree(gpiomtd); | ||
263 | |||
264 | return 0; | 262 | return 0; |
265 | } | 263 | } |
266 | 264 | ||
@@ -297,7 +295,7 @@ static int gpio_nand_probe(struct platform_device *dev) | |||
297 | if (!res0) | 295 | if (!res0) |
298 | return -EINVAL; | 296 | return -EINVAL; |
299 | 297 | ||
300 | gpiomtd = kzalloc(sizeof(*gpiomtd), GFP_KERNEL); | 298 | gpiomtd = devm_kzalloc(&dev->dev, sizeof(*gpiomtd), GFP_KERNEL); |
301 | if (gpiomtd == NULL) { | 299 | if (gpiomtd == NULL) { |
302 | dev_err(&dev->dev, "failed to create NAND MTD\n"); | 300 | dev_err(&dev->dev, "failed to create NAND MTD\n"); |
303 | return -ENOMEM; | 301 | return -ENOMEM; |
@@ -412,7 +410,6 @@ err_sync: | |||
412 | iounmap(gpiomtd->nand_chip.IO_ADDR_R); | 410 | iounmap(gpiomtd->nand_chip.IO_ADDR_R); |
413 | release_mem_region(res0->start, resource_size(res0)); | 411 | release_mem_region(res0->start, resource_size(res0)); |
414 | err_map: | 412 | err_map: |
415 | kfree(gpiomtd); | ||
416 | return ret; | 413 | return ret; |
417 | } | 414 | } |
418 | 415 | ||