提交 edaf4d4a 编写于 作者: F Fabio Estevam 提交者: Brian Norris

mtd: gpmi: Use devm_kzalloc()

Using devm_kzalloc() can make the code simpler.
Signed-off-by: NFabio Estevam <fabio.estevam@freescale.com>
Acked-by: NHuang Shijie <b32955@freescale.com>
Signed-off-by: NBrian Norris <computersforpeace@gmail.com>
上级 a749d13a
...@@ -1732,7 +1732,7 @@ static int gpmi_nand_probe(struct platform_device *pdev) ...@@ -1732,7 +1732,7 @@ static int gpmi_nand_probe(struct platform_device *pdev)
return -ENODEV; return -ENODEV;
} }
this = kzalloc(sizeof(*this), GFP_KERNEL); this = devm_kzalloc(&pdev->dev, sizeof(*this), GFP_KERNEL);
if (!this) { if (!this) {
pr_err("Failed to allocate per-device memory\n"); pr_err("Failed to allocate per-device memory\n");
return -ENOMEM; return -ENOMEM;
...@@ -1762,7 +1762,6 @@ static int gpmi_nand_probe(struct platform_device *pdev) ...@@ -1762,7 +1762,6 @@ static int gpmi_nand_probe(struct platform_device *pdev)
release_resources(this); release_resources(this);
exit_acquire_resources: exit_acquire_resources:
dev_err(this->dev, "driver registration failed: %d\n", ret); dev_err(this->dev, "driver registration failed: %d\n", ret);
kfree(this);
return ret; return ret;
} }
...@@ -1773,7 +1772,6 @@ static int gpmi_nand_remove(struct platform_device *pdev) ...@@ -1773,7 +1772,6 @@ static int gpmi_nand_remove(struct platform_device *pdev)
gpmi_nfc_exit(this); gpmi_nfc_exit(this);
release_resources(this); release_resources(this);
kfree(this);
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册