Commit 3c39c9c6 authored by Patil, Rachna's avatar Patil, Rachna Committed by Samuel Ortiz

MFD: ti_am335x_tscadc: Pass correct error message

Pass on the correct error message from platform_get_irq()
instead of hard coding it to "EINVAL".

Also change label from "err" to "ret" for better
readability and update the same in error path.
Signed-off-by: default avatarPatil, Rachna <rachna@ti.com>
Signed-off-by: default avatarSamuel Ortiz <sameo@linux.intel.com>
parent 5e393a22
...@@ -65,7 +65,6 @@ static int __devinit ti_tscadc_probe(struct platform_device *pdev) ...@@ -65,7 +65,6 @@ static int __devinit ti_tscadc_probe(struct platform_device *pdev)
struct clk *clk; struct clk *clk;
struct mfd_tscadc_board *pdata = pdev->dev.platform_data; struct mfd_tscadc_board *pdata = pdev->dev.platform_data;
struct mfd_cell *cell; struct mfd_cell *cell;
int irq;
int err, ctrl; int err, ctrl;
int clk_value, clock_rate; int clk_value, clock_rate;
int tsc_wires, adc_channels = 0, total_channels; int tsc_wires, adc_channels = 0, total_channels;
...@@ -92,12 +91,6 @@ static int __devinit ti_tscadc_probe(struct platform_device *pdev) ...@@ -92,12 +91,6 @@ static int __devinit ti_tscadc_probe(struct platform_device *pdev)
return -EINVAL; return -EINVAL;
} }
irq = platform_get_irq(pdev, 0);
if (irq < 0) {
dev_err(&pdev->dev, "no irq ID is specified.\n");
return -EINVAL;
}
/* Allocate memory for device */ /* Allocate memory for device */
tscadc = devm_kzalloc(&pdev->dev, tscadc = devm_kzalloc(&pdev->dev,
sizeof(struct ti_tscadc_dev), GFP_KERNEL); sizeof(struct ti_tscadc_dev), GFP_KERNEL);
...@@ -106,22 +99,26 @@ static int __devinit ti_tscadc_probe(struct platform_device *pdev) ...@@ -106,22 +99,26 @@ static int __devinit ti_tscadc_probe(struct platform_device *pdev)
return -ENOMEM; return -ENOMEM;
} }
tscadc->dev = &pdev->dev; tscadc->dev = &pdev->dev;
tscadc->irq = irq;
err = platform_get_irq(pdev, 0);
if (err < 0) {
dev_err(&pdev->dev, "no irq ID is specified.\n");
goto ret;
} else
tscadc->irq = err;
res = devm_request_mem_region(&pdev->dev, res = devm_request_mem_region(&pdev->dev,
res->start, resource_size(res), pdev->name); res->start, resource_size(res), pdev->name);
if (!res) { if (!res) {
dev_err(&pdev->dev, "failed to reserve registers.\n"); dev_err(&pdev->dev, "failed to reserve registers.\n");
err = -EBUSY; return -EBUSY;
goto err;
} }
tscadc->tscadc_base = devm_ioremap(&pdev->dev, tscadc->tscadc_base = devm_ioremap(&pdev->dev,
res->start, resource_size(res)); res->start, resource_size(res));
if (!tscadc->tscadc_base) { if (!tscadc->tscadc_base) {
dev_err(&pdev->dev, "failed to map registers.\n"); dev_err(&pdev->dev, "failed to map registers.\n");
err = -ENOMEM; return -ENOMEM;
goto err;
} }
tscadc->regmap_tscadc = devm_regmap_init_mmio(&pdev->dev, tscadc->regmap_tscadc = devm_regmap_init_mmio(&pdev->dev,
...@@ -129,7 +126,7 @@ static int __devinit ti_tscadc_probe(struct platform_device *pdev) ...@@ -129,7 +126,7 @@ static int __devinit ti_tscadc_probe(struct platform_device *pdev)
if (IS_ERR(tscadc->regmap_tscadc)) { if (IS_ERR(tscadc->regmap_tscadc)) {
dev_err(&pdev->dev, "regmap init failed\n"); dev_err(&pdev->dev, "regmap init failed\n");
err = PTR_ERR(tscadc->regmap_tscadc); err = PTR_ERR(tscadc->regmap_tscadc);
goto err; goto ret;
} }
pm_runtime_enable(&pdev->dev); pm_runtime_enable(&pdev->dev);
...@@ -201,7 +198,7 @@ static int __devinit ti_tscadc_probe(struct platform_device *pdev) ...@@ -201,7 +198,7 @@ static int __devinit ti_tscadc_probe(struct platform_device *pdev)
err_disable_clk: err_disable_clk:
pm_runtime_put_sync(&pdev->dev); pm_runtime_put_sync(&pdev->dev);
pm_runtime_disable(&pdev->dev); pm_runtime_disable(&pdev->dev);
err: ret:
return err; return err;
} }
......
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