Commit cf48f56c authored by Sylwester Nawrocki's avatar Sylwester Nawrocki Committed by Mauro Carvalho Chehab

[media] s5p-tv: Fix return value in sdo_probe() on error paths

Use proper return value test for clk_get() and devm_regulator_get()
functions and propagate any errors from the clock and the regulator
subsystem to the driver core. In two cases a proper error code is
now returned rather than 0.
Reported-by: default avatarPeter Senna Tschudin <peter.senna@gmail.com>
Signed-off-by: default avatarSylwester Nawrocki <s.nawrocki@samsung.com>
Signed-off-by: default avatarKyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 740ad921
...@@ -341,47 +341,50 @@ static int __devinit sdo_probe(struct platform_device *pdev) ...@@ -341,47 +341,50 @@ static int __devinit sdo_probe(struct platform_device *pdev)
/* acquire clocks */ /* acquire clocks */
sdev->sclk_dac = clk_get(dev, "sclk_dac"); sdev->sclk_dac = clk_get(dev, "sclk_dac");
if (IS_ERR_OR_NULL(sdev->sclk_dac)) { if (IS_ERR(sdev->sclk_dac)) {
dev_err(dev, "failed to get clock 'sclk_dac'\n"); dev_err(dev, "failed to get clock 'sclk_dac'\n");
ret = -ENXIO; ret = PTR_ERR(sdev->sclk_dac);
goto fail; goto fail;
} }
sdev->dac = clk_get(dev, "dac"); sdev->dac = clk_get(dev, "dac");
if (IS_ERR_OR_NULL(sdev->dac)) { if (IS_ERR(sdev->dac)) {
dev_err(dev, "failed to get clock 'dac'\n"); dev_err(dev, "failed to get clock 'dac'\n");
ret = -ENXIO; ret = PTR_ERR(sdev->dac);
goto fail_sclk_dac; goto fail_sclk_dac;
} }
sdev->dacphy = clk_get(dev, "dacphy"); sdev->dacphy = clk_get(dev, "dacphy");
if (IS_ERR_OR_NULL(sdev->dacphy)) { if (IS_ERR(sdev->dacphy)) {
dev_err(dev, "failed to get clock 'dacphy'\n"); dev_err(dev, "failed to get clock 'dacphy'\n");
ret = -ENXIO; ret = PTR_ERR(sdev->dacphy);
goto fail_dac; goto fail_dac;
} }
sclk_vpll = clk_get(dev, "sclk_vpll"); sclk_vpll = clk_get(dev, "sclk_vpll");
if (IS_ERR_OR_NULL(sclk_vpll)) { if (IS_ERR(sclk_vpll)) {
dev_err(dev, "failed to get clock 'sclk_vpll'\n"); dev_err(dev, "failed to get clock 'sclk_vpll'\n");
ret = -ENXIO; ret = PTR_ERR(sclk_vpll);
goto fail_dacphy; goto fail_dacphy;
} }
clk_set_parent(sdev->sclk_dac, sclk_vpll); clk_set_parent(sdev->sclk_dac, sclk_vpll);
clk_put(sclk_vpll); clk_put(sclk_vpll);
sdev->fout_vpll = clk_get(dev, "fout_vpll"); sdev->fout_vpll = clk_get(dev, "fout_vpll");
if (IS_ERR_OR_NULL(sdev->fout_vpll)) { if (IS_ERR(sdev->fout_vpll)) {
dev_err(dev, "failed to get clock 'fout_vpll'\n"); dev_err(dev, "failed to get clock 'fout_vpll'\n");
ret = PTR_ERR(sdev->fout_vpll);
goto fail_dacphy; goto fail_dacphy;
} }
dev_info(dev, "fout_vpll.rate = %lu\n", clk_get_rate(sclk_vpll)); dev_info(dev, "fout_vpll.rate = %lu\n", clk_get_rate(sclk_vpll));
/* acquire regulator */ /* acquire regulator */
sdev->vdac = devm_regulator_get(dev, "vdd33a_dac"); sdev->vdac = devm_regulator_get(dev, "vdd33a_dac");
if (IS_ERR_OR_NULL(sdev->vdac)) { if (IS_ERR(sdev->vdac)) {
dev_err(dev, "failed to get regulator 'vdac'\n"); dev_err(dev, "failed to get regulator 'vdac'\n");
ret = PTR_ERR(sdev->vdac);
goto fail_fout_vpll; goto fail_fout_vpll;
} }
sdev->vdet = devm_regulator_get(dev, "vdet"); sdev->vdet = devm_regulator_get(dev, "vdet");
if (IS_ERR_OR_NULL(sdev->vdet)) { if (IS_ERR(sdev->vdet)) {
dev_err(dev, "failed to get regulator 'vdet'\n"); dev_err(dev, "failed to get regulator 'vdet'\n");
ret = PTR_ERR(sdev->vdet);
goto fail_fout_vpll; goto fail_fout_vpll;
} }
......
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