Commit bb8bdc77 authored by Thomas Abraham's avatar Thomas Abraham Committed by Chris Ball

mmc: dw_mmc: Use devm_* functions in dw_mmc platform driver

Use devm_* managed functions for simpler error handling.
Signed-off-by: default avatarThomas Abraham <thomas.abraham@linaro.org>
Acked-by: default avatarWill Newton <will.newton@imgtec.com>
Signed-off-by: default avatarChris Ball <cjb@laptop.org>
parent 4a90920c
...@@ -27,38 +27,27 @@ static int __devinit dw_mci_pltfm_probe(struct platform_device *pdev) ...@@ -27,38 +27,27 @@ static int __devinit dw_mci_pltfm_probe(struct platform_device *pdev)
struct resource *regs; struct resource *regs;
int ret; int ret;
host = kzalloc(sizeof(struct dw_mci), GFP_KERNEL); host = devm_kzalloc(&pdev->dev, sizeof(struct dw_mci), GFP_KERNEL);
if (!host) if (!host)
return -ENOMEM; return -ENOMEM;
regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!regs) { if (!regs)
ret = -ENXIO; return -ENXIO;
goto err_free;
}
host->irq = platform_get_irq(pdev, 0); host->irq = platform_get_irq(pdev, 0);
if (host->irq < 0) { if (host->irq < 0)
ret = host->irq; return host->irq;
goto err_free;
}
host->dev = &pdev->dev; host->dev = &pdev->dev;
host->irq_flags = 0; host->irq_flags = 0;
host->pdata = pdev->dev.platform_data; host->pdata = pdev->dev.platform_data;
ret = -ENOMEM; host->regs = devm_request_and_ioremap(&pdev->dev, regs);
host->regs = ioremap(regs->start, resource_size(regs));
if (!host->regs) if (!host->regs)
goto err_free; return -ENOMEM;
platform_set_drvdata(pdev, host); platform_set_drvdata(pdev, host);
ret = dw_mci_probe(host); ret = dw_mci_probe(host);
if (ret)
goto err_out;
return ret;
err_out:
iounmap(host->regs);
err_free:
kfree(host);
return ret; return ret;
} }
...@@ -68,8 +57,6 @@ static int __devexit dw_mci_pltfm_remove(struct platform_device *pdev) ...@@ -68,8 +57,6 @@ static int __devexit dw_mci_pltfm_remove(struct platform_device *pdev)
platform_set_drvdata(pdev, NULL); platform_set_drvdata(pdev, NULL);
dw_mci_remove(host); dw_mci_remove(host);
iounmap(host->regs);
kfree(host);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment