Commit bda8fa89 authored by Madhusudhan Chikkature's avatar Madhusudhan Chikkature Committed by Tony Lindgren

HDQ driver: modify probe fn exit points

This patch fix the exit paths in the probe function.
Signed-off-by: default avatarMadhusudhan Chikkature <madhu.cr@ti.com>
Acked-by: default avatarEvgeniy Polyakov <johnpol@2ka.mipt.ru>
Acked-by: default avatarFelipe Balbi <felipe.balbi@nokia.com>
Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
parent 83475c93
...@@ -573,17 +573,20 @@ static int __init omap_hdq_probe(struct platform_device *pdev) ...@@ -573,17 +573,20 @@ static int __init omap_hdq_probe(struct platform_device *pdev)
return -ENODEV; return -ENODEV;
hdq_data = kmalloc(sizeof(*hdq_data), GFP_KERNEL); hdq_data = kmalloc(sizeof(*hdq_data), GFP_KERNEL);
if (!hdq_data) if (!hdq_data) {
return -ENODEV; dev_dbg(&pdev->dev, "unable to allocate memory\n");
ret = -ENODEV;
goto err_kmalloc;
}
hdq_data->dev = &pdev->dev; hdq_data->dev = &pdev->dev;
platform_set_drvdata(pdev, hdq_data); platform_set_drvdata(pdev, hdq_data);
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (res == NULL) { if (!res) {
platform_set_drvdata(pdev, NULL); dev_dbg(&pdev->dev, "unable to get resource\n");
kfree(hdq_data); ret = ENXIO;
return -ENXIO; goto err_resource;
} }
hdq_data->hdq_base = res->start; hdq_data->hdq_base = res->start;
...@@ -596,15 +599,12 @@ static int __init omap_hdq_probe(struct platform_device *pdev) ...@@ -596,15 +599,12 @@ static int __init omap_hdq_probe(struct platform_device *pdev)
dev_dbg(&pdev->dev, "Can't get HDQ clock objects\n"); dev_dbg(&pdev->dev, "Can't get HDQ clock objects\n");
if (IS_ERR(hdq_data->hdq_ick)) { if (IS_ERR(hdq_data->hdq_ick)) {
ret = PTR_ERR(hdq_data->hdq_ick); ret = PTR_ERR(hdq_data->hdq_ick);
platform_set_drvdata(pdev, NULL); goto err_clk;
kfree(hdq_data);
return ret;
} }
if (IS_ERR(hdq_data->hdq_fck)) { if (IS_ERR(hdq_data->hdq_fck)) {
ret = PTR_ERR(hdq_data->hdq_fck); ret = PTR_ERR(hdq_data->hdq_fck);
platform_set_drvdata(pdev, NULL); clk_put(hdq_data->hdq_ick);
kfree(hdq_data); goto err_clk;
return ret;
} }
} }
...@@ -613,21 +613,14 @@ static int __init omap_hdq_probe(struct platform_device *pdev) ...@@ -613,21 +613,14 @@ static int __init omap_hdq_probe(struct platform_device *pdev)
if (clk_enable(hdq_data->hdq_ick)) { if (clk_enable(hdq_data->hdq_ick)) {
dev_dbg(&pdev->dev, "Can not enable ick\n"); dev_dbg(&pdev->dev, "Can not enable ick\n");
clk_put(hdq_data->hdq_ick); ret = -ENODEV;
clk_put(hdq_data->hdq_fck); goto err_ick;
platform_set_drvdata(pdev, NULL);
kfree(hdq_data);
return -ENODEV;
} }
if (clk_enable(hdq_data->hdq_fck)) { if (clk_enable(hdq_data->hdq_fck)) {
dev_dbg(&pdev->dev, "Can not enable fck\n"); dev_dbg(&pdev->dev, "Can not enable fck\n");
clk_disable(hdq_data->hdq_ick); ret = -ENODEV;
clk_put(hdq_data->hdq_ick); goto err_fck;
clk_put(hdq_data->hdq_fck);
platform_set_drvdata(pdev, NULL);
kfree(hdq_data);
return -ENODEV;
} }
rev = hdq_reg_in(hdq_data, OMAP_HDQ_REVISION); rev = hdq_reg_in(hdq_data, OMAP_HDQ_REVISION);
...@@ -639,20 +632,14 @@ static int __init omap_hdq_probe(struct platform_device *pdev) ...@@ -639,20 +632,14 @@ static int __init omap_hdq_probe(struct platform_device *pdev)
irq = platform_get_irq(pdev, 0); irq = platform_get_irq(pdev, 0);
if (irq < 0) { if (irq < 0) {
platform_set_drvdata(pdev, NULL); ret = -ENXIO;
kfree(hdq_data); goto err_irq;
return -ENXIO;
} }
if (request_irq(irq, hdq_isr, IRQF_DISABLED, "OMAP HDQ", ret = request_irq(irq, hdq_isr, IRQF_DISABLED, "omap_hdq", hdq_data);
hdq_data)) { if (ret < 0) {
dev_dbg(&pdev->dev, "request_irq failed\n"); dev_dbg(&pdev->dev, "could not request irq\n");
clk_disable(hdq_data->hdq_ick); goto err_irq;
clk_put(hdq_data->hdq_ick);
clk_put(hdq_data->hdq_fck);
platform_set_drvdata(pdev, NULL);
kfree(hdq_data);
return -ENODEV;
} }
/* don't clock the HDQ until it is needed */ /* don't clock the HDQ until it is needed */
...@@ -664,14 +651,32 @@ static int __init omap_hdq_probe(struct platform_device *pdev) ...@@ -664,14 +651,32 @@ static int __init omap_hdq_probe(struct platform_device *pdev)
ret = w1_add_master_device(&omap_w1_master); ret = w1_add_master_device(&omap_w1_master);
if (ret) { if (ret) {
dev_dbg(&pdev->dev, "Failure in registering w1 master\n"); dev_dbg(&pdev->dev, "Failure in registering w1 master\n");
goto err_w1;
}
return 0;
err_w1:
err_irq:
clk_disable(hdq_data->hdq_fck);
err_fck:
clk_disable(hdq_data->hdq_ick);
err_ick:
clk_put(hdq_data->hdq_ick); clk_put(hdq_data->hdq_ick);
clk_put(hdq_data->hdq_fck); clk_put(hdq_data->hdq_fck);
err_clk:
hdq_data->hdq_base = NULL;
err_resource:
platform_set_drvdata(pdev, NULL); platform_set_drvdata(pdev, NULL);
kfree(hdq_data); kfree(hdq_data);
err_kmalloc:
return ret; return ret;
}
return 0;
} }
static int omap_hdq_remove(struct platform_device *pdev) static int omap_hdq_remove(struct platform_device *pdev)
......
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