diff mbox

[1/6] mmc: omap: Convert to devm_kzalloc

Message ID 1378922517-3968-1-git-send-email-jarkko.nikula@bitmer.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jarkko Nikula Sept. 11, 2013, 6:01 p.m. UTC
Signed-off-by: Jarkko Nikula <jarkko.nikula@bitmer.com>
---
 drivers/mmc/host/omap.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Comments

Jarkko Nikula Oct. 6, 2013, 5:41 p.m. UTC | #1
Hi

On 09/11/2013 09:01 PM, Jarkko Nikula wrote:
> Signed-off-by: Jarkko Nikula <jarkko.nikula@bitmer.com>
> ---
>  drivers/mmc/host/omap.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
I resent this set with a subject prefix "PATCH FIX+RESEND" since I found
a NULL pointer dereference case from this driver and I put a fix for it
first and rebased these 6 patches on top of it.
diff mbox

Patch

diff --git a/drivers/mmc/host/omap.c b/drivers/mmc/host/omap.c
index b94f38e..03179da 100644
--- a/drivers/mmc/host/omap.c
+++ b/drivers/mmc/host/omap.c
@@ -1354,7 +1354,8 @@  static int mmc_omap_probe(struct platform_device *pdev)
 	if (res == NULL)
 		return -EBUSY;
 
-	host = kzalloc(sizeof(struct mmc_omap_host), GFP_KERNEL);
+	host = devm_kzalloc(&pdev->dev, sizeof(struct mmc_omap_host),
+			    GFP_KERNEL);
 	if (host == NULL) {
 		ret = -ENOMEM;
 		goto err_free_mem_region;
@@ -1473,7 +1474,6 @@  err_free_iclk:
 err_free_mmc_host:
 	iounmap(host->virt_base);
 err_ioremap:
-	kfree(host);
 err_free_mem_region:
 	release_mem_region(res->start, resource_size(res));
 	return ret;
@@ -1508,8 +1508,6 @@  static int mmc_omap_remove(struct platform_device *pdev)
 			   pdev->resource[0].end - pdev->resource[0].start + 1);
 	destroy_workqueue(host->mmc_omap_wq);
 
-	kfree(host);
-
 	return 0;
 }