diff options
author | Fabio Estevam <fabio.estevam@freescale.com> | 2013-11-04 21:07:05 -0500 |
---|---|---|
committer | Brian Norris <computersforpeace@gmail.com> | 2013-11-07 13:37:32 -0500 |
commit | edaf4d4aad61134e820c0431cbe3d319794899f9 (patch) | |
tree | 7119f7fb7d46b083173728f16228e7307327fc4c /drivers/mtd/nand | |
parent | a749d13acd8e079ed4c77a9456d842dc94af8f17 (diff) |
mtd: gpmi: Use devm_kzalloc()
Using devm_kzalloc() can make the code simpler.
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Acked-by: Huang Shijie <b32955@freescale.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Diffstat (limited to 'drivers/mtd/nand')
-rw-r--r-- | drivers/mtd/nand/gpmi-nand/gpmi-nand.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c index 7ac22802e4dc..4b6d802018fb 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) | |||
1732 | return -ENODEV; | 1732 | return -ENODEV; |
1733 | } | 1733 | } |
1734 | 1734 | ||
1735 | this = kzalloc(sizeof(*this), GFP_KERNEL); | 1735 | this = devm_kzalloc(&pdev->dev, sizeof(*this), GFP_KERNEL); |
1736 | if (!this) { | 1736 | if (!this) { |
1737 | pr_err("Failed to allocate per-device memory\n"); | 1737 | pr_err("Failed to allocate per-device memory\n"); |
1738 | return -ENOMEM; | 1738 | return -ENOMEM; |
@@ -1762,7 +1762,6 @@ exit_nfc_init: | |||
1762 | release_resources(this); | 1762 | release_resources(this); |
1763 | exit_acquire_resources: | 1763 | exit_acquire_resources: |
1764 | dev_err(this->dev, "driver registration failed: %d\n", ret); | 1764 | dev_err(this->dev, "driver registration failed: %d\n", ret); |
1765 | kfree(this); | ||
1766 | 1765 | ||
1767 | return ret; | 1766 | return ret; |
1768 | } | 1767 | } |
@@ -1773,7 +1772,6 @@ static int gpmi_nand_remove(struct platform_device *pdev) | |||
1773 | 1772 | ||
1774 | gpmi_nfc_exit(this); | 1773 | gpmi_nfc_exit(this); |
1775 | release_resources(this); | 1774 | release_resources(this); |
1776 | kfree(this); | ||
1777 | return 0; | 1775 | return 0; |
1778 | } | 1776 | } |
1779 | 1777 | ||