summaryrefslogtreecommitdiff
path: root/drivers/media
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2017-10-21 04:37:49 -0400
committerMauro Carvalho Chehab <mchehab@s-opensource.com>2017-10-31 07:23:52 -0400
commit3ddad1ae10c23a700e060edab11eb13ec01ea380 (patch)
tree8f05f2ad6a6cad664d1704346843c91e666a0ff6 /drivers/media
parent6981d6e55c70b831acf8bea99545adcf940949b5 (diff)
media: tegra-cec: fix messy probe() cleanup
The probe() cleanup code ('goto foo_error') was very messy. It appears that this code wasn't updated when I switched to the devm_ functions in an earlier version. Update the code to use 'return error' where it can and do proper cleanup where it needs to. Note that the original code wasn't buggy, it was just messy. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/platform/tegra-cec/tegra_cec.c26
1 files changed, 10 insertions, 16 deletions
diff --git a/drivers/media/platform/tegra-cec/tegra_cec.c b/drivers/media/platform/tegra-cec/tegra_cec.c
index b53743f555e8..807c94c70049 100644
--- a/drivers/media/platform/tegra-cec/tegra_cec.c
+++ b/drivers/media/platform/tegra-cec/tegra_cec.c
@@ -356,40 +356,34 @@ static int tegra_cec_probe(struct platform_device *pdev)
if (!res) {
dev_err(&pdev->dev,
"Unable to allocate resources for device\n");
- ret = -EBUSY;
- goto cec_error;
+ return -EBUSY;
}
if (!devm_request_mem_region(&pdev->dev, res->start, resource_size(res),
pdev->name)) {
dev_err(&pdev->dev,
"Unable to request mem region for device\n");
- ret = -EBUSY;
- goto cec_error;
+ return -EBUSY;
}
cec->tegra_cec_irq = platform_get_irq(pdev, 0);
- if (cec->tegra_cec_irq <= 0) {
- ret = -EBUSY;
- goto cec_error;
- }
+ if (cec->tegra_cec_irq <= 0)
+ return -EBUSY;
cec->cec_base = devm_ioremap_nocache(&pdev->dev, res->start,
- resource_size(res));
+ resource_size(res));
if (!cec->cec_base) {
dev_err(&pdev->dev, "Unable to grab IOs for device\n");
- ret = -EBUSY;
- goto cec_error;
+ return -EBUSY;
}
cec->clk = devm_clk_get(&pdev->dev, "cec");
if (IS_ERR_OR_NULL(cec->clk)) {
dev_err(&pdev->dev, "Can't get clock for CEC\n");
- ret = -ENOENT;
- goto clk_error;
+ return -ENOENT;
}
clk_prepare_enable(cec->clk);
@@ -406,13 +400,13 @@ static int tegra_cec_probe(struct platform_device *pdev)
if (ret) {
dev_err(&pdev->dev,
"Unable to request interrupt for device\n");
- goto cec_error;
+ goto clk_error;
}
cec->notifier = cec_notifier_get(&hdmi_dev->dev);
if (!cec->notifier) {
ret = -ENOMEM;
- goto cec_error;
+ goto clk_error;
}
cec->adap = cec_allocate_adapter(&tegra_cec_ops, cec, TEGRA_CEC_NAME,
@@ -437,8 +431,8 @@ cec_error:
if (cec->notifier)
cec_notifier_put(cec->notifier);
cec_delete_adapter(cec->adap);
- clk_disable_unprepare(cec->clk);
clk_error:
+ clk_disable_unprepare(cec->clk);
return ret;
}