mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00
media: platform: stm32: unprepare clocks at handling errors in probe
stm32_cec_probe() did not unprepare clocks on error handling paths. The patch fixes that. Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Evgeny Novikov <novikov@ispras.ru> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
This commit is contained in:
parent
514e976744
commit
055d2db28e
1 changed files with 18 additions and 8 deletions
|
@ -305,14 +305,16 @@ static int stm32_cec_probe(struct platform_device *pdev)
|
||||||
|
|
||||||
cec->clk_hdmi_cec = devm_clk_get(&pdev->dev, "hdmi-cec");
|
cec->clk_hdmi_cec = devm_clk_get(&pdev->dev, "hdmi-cec");
|
||||||
if (IS_ERR(cec->clk_hdmi_cec) &&
|
if (IS_ERR(cec->clk_hdmi_cec) &&
|
||||||
PTR_ERR(cec->clk_hdmi_cec) == -EPROBE_DEFER)
|
PTR_ERR(cec->clk_hdmi_cec) == -EPROBE_DEFER) {
|
||||||
return -EPROBE_DEFER;
|
ret = -EPROBE_DEFER;
|
||||||
|
goto err_unprepare_cec_clk;
|
||||||
|
}
|
||||||
|
|
||||||
if (!IS_ERR(cec->clk_hdmi_cec)) {
|
if (!IS_ERR(cec->clk_hdmi_cec)) {
|
||||||
ret = clk_prepare(cec->clk_hdmi_cec);
|
ret = clk_prepare(cec->clk_hdmi_cec);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
dev_err(&pdev->dev, "Can't prepare hdmi-cec clock\n");
|
dev_err(&pdev->dev, "Can't prepare hdmi-cec clock\n");
|
||||||
return ret;
|
goto err_unprepare_cec_clk;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -324,19 +326,27 @@ static int stm32_cec_probe(struct platform_device *pdev)
|
||||||
CEC_NAME, caps, CEC_MAX_LOG_ADDRS);
|
CEC_NAME, caps, CEC_MAX_LOG_ADDRS);
|
||||||
ret = PTR_ERR_OR_ZERO(cec->adap);
|
ret = PTR_ERR_OR_ZERO(cec->adap);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
goto err_unprepare_hdmi_cec_clk;
|
||||||
|
|
||||||
ret = cec_register_adapter(cec->adap, &pdev->dev);
|
ret = cec_register_adapter(cec->adap, &pdev->dev);
|
||||||
if (ret) {
|
if (ret)
|
||||||
cec_delete_adapter(cec->adap);
|
goto err_delete_adapter;
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
cec_hw_init(cec);
|
cec_hw_init(cec);
|
||||||
|
|
||||||
platform_set_drvdata(pdev, cec);
|
platform_set_drvdata(pdev, cec);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
err_delete_adapter:
|
||||||
|
cec_delete_adapter(cec->adap);
|
||||||
|
|
||||||
|
err_unprepare_hdmi_cec_clk:
|
||||||
|
clk_unprepare(cec->clk_hdmi_cec);
|
||||||
|
|
||||||
|
err_unprepare_cec_clk:
|
||||||
|
clk_unprepare(cec->clk_cec);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int stm32_cec_remove(struct platform_device *pdev)
|
static int stm32_cec_remove(struct platform_device *pdev)
|
||||||
|
|
Loading…
Add table
Reference in a new issue