diff options
author | Sachin Kamat <sachin.kamat@linaro.org> | 2013-10-08 15:31:46 +0530 |
---|---|---|
committer | Brian Norris <computersforpeace@gmail.com> | 2013-11-06 23:32:50 -0800 |
commit | cf3a9b56a128ec8a1631c29aacb8cf19b55ea73d (patch) | |
tree | fc52e8615f80d6f27f656bba5ace3399c02e75c8 /drivers/mtd | |
parent | ecb598d0b2ca4897a3962aed7680ee3d28dda6e8 (diff) |
mtd: socrates_nand: Use devm_kzalloc
devm_kzalloc is device managed and makes code simpler.
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Diffstat (limited to 'drivers/mtd')
-rw-r--r-- | drivers/mtd/nand/socrates_nand.c | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/drivers/mtd/nand/socrates_nand.c b/drivers/mtd/nand/socrates_nand.c index f44c7c884a2..e77da7efa20 100644 --- a/drivers/mtd/nand/socrates_nand.c +++ b/drivers/mtd/nand/socrates_nand.c @@ -149,17 +149,13 @@ static int socrates_nand_probe(struct platform_device *ofdev) struct mtd_part_parser_data ppdata; /* Allocate memory for the device structure (and zero it) */ - host = kzalloc(sizeof(struct socrates_nand_host), GFP_KERNEL); - if (!host) { - printk(KERN_ERR - "socrates_nand: failed to allocate device structure.\n"); + host = devm_kzalloc(&ofdev->dev, sizeof(*host), GFP_KERNEL); + if (!host) return -ENOMEM; - } host->io_base = of_iomap(ofdev->dev.of_node, 0); if (host->io_base == NULL) { printk(KERN_ERR "socrates_nand: ioremap failed\n"); - kfree(host); return -EIO; } @@ -212,7 +208,6 @@ static int socrates_nand_probe(struct platform_device *ofdev) out: iounmap(host->io_base); - kfree(host); return res; } @@ -227,7 +222,6 @@ static int socrates_nand_remove(struct platform_device *ofdev) nand_release(mtd); iounmap(host->io_base); - kfree(host); return 0; } |