mtd: gpmi: Use devm_kzalloc()
Linux-MTD Mailing List
linux-mtd at lists.infradead.org
Wed Nov 13 13:59:06 EST 2013
Gitweb: http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=edaf4d4aad61134e820c0431cbe3d319794899f9
Commit: edaf4d4aad61134e820c0431cbe3d319794899f9
Parent: a749d13acd8e079ed4c77a9456d842dc94af8f17
Author: Fabio Estevam <fabio.estevam at freescale.com>
AuthorDate: Tue Nov 5 00:07:05 2013 -0200
Committer: Brian Norris <computersforpeace at gmail.com>
CommitDate: Thu Nov 7 10:37:32 2013 -0800
mtd: gpmi: Use devm_kzalloc()
Using devm_kzalloc() can make the code simpler.
Signed-off-by: Fabio Estevam <fabio.estevam at freescale.com>
Acked-by: Huang Shijie <b32955 at freescale.com>
Signed-off-by: Brian Norris <computersforpeace at gmail.com>
---
drivers/mtd/nand/gpmi-nand/gpmi-nand.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
index 7ac2280..4b6d802 100644
--- a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
+++ b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c
@@ -1732,7 +1732,7 @@ static int gpmi_nand_probe(struct platform_device *pdev)
return -ENODEV;
}
- this = kzalloc(sizeof(*this), GFP_KERNEL);
+ this = devm_kzalloc(&pdev->dev, sizeof(*this), GFP_KERNEL);
if (!this) {
pr_err("Failed to allocate per-device memory\n");
return -ENOMEM;
@@ -1762,7 +1762,6 @@ exit_nfc_init:
release_resources(this);
exit_acquire_resources:
dev_err(this->dev, "driver registration failed: %d\n", ret);
- kfree(this);
return ret;
}
@@ -1773,7 +1772,6 @@ static int gpmi_nand_remove(struct platform_device *pdev)
gpmi_nfc_exit(this);
release_resources(this);
- kfree(this);
return 0;
}
More information about the linux-mtd-cvs
mailing list