From: Fabio Estevam Date: Tue, 5 Nov 2013 02:07:05 +0000 (-0200) Subject: mtd: gpmi: Use devm_kzalloc() X-Git-Tag: v3.13-rc1~98^2~4 X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=commitdiff_plain;h=edaf4d4aad61134e820c0431cbe3d319794899f9;p=linux.git mtd: gpmi: Use devm_kzalloc() Using devm_kzalloc() can make the code simpler. Signed-off-by: Fabio Estevam Acked-by: Huang Shijie Signed-off-by: Brian Norris --- 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) 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 @@ static int gpmi_nand_probe(struct platform_device *pdev) 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; }