mirror of
https://github.com/torvalds/linux.git
synced 2026-06-04 04:23:35 +02:00
media: sunxi: Fix some error handling path of sun8i_a83t_mipi_csi2_probe()
Release some resources in the error handling path of the probe and of
sun8i_a83t_mipi_csi2_resources_setup(), as already done in the remove
function.
Fixes: 576d196c52 ("media: sunxi: Add support for the A83T MIPI CSI-2 controller")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Acked-by: Paul Kocialkowski <paul.kocialkowski@bootlin.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
This commit is contained in:
parent
a90bc00077
commit
466c1e6d05
|
|
@ -719,13 +719,15 @@ sun8i_a83t_mipi_csi2_resources_setup(struct sun8i_a83t_mipi_csi2_device *csi2_de
|
|||
csi2_dev->clock_mipi = devm_clk_get(dev, "mipi");
|
||||
if (IS_ERR(csi2_dev->clock_mipi)) {
|
||||
dev_err(dev, "failed to acquire mipi clock\n");
|
||||
return PTR_ERR(csi2_dev->clock_mipi);
|
||||
ret = PTR_ERR(csi2_dev->clock_mipi);
|
||||
goto error_clock_rate_exclusive;
|
||||
}
|
||||
|
||||
csi2_dev->clock_misc = devm_clk_get(dev, "misc");
|
||||
if (IS_ERR(csi2_dev->clock_misc)) {
|
||||
dev_err(dev, "failed to acquire misc clock\n");
|
||||
return PTR_ERR(csi2_dev->clock_misc);
|
||||
ret = PTR_ERR(csi2_dev->clock_misc);
|
||||
goto error_clock_rate_exclusive;
|
||||
}
|
||||
|
||||
/* Reset */
|
||||
|
|
@ -733,7 +735,8 @@ sun8i_a83t_mipi_csi2_resources_setup(struct sun8i_a83t_mipi_csi2_device *csi2_de
|
|||
csi2_dev->reset = devm_reset_control_get_shared(dev, NULL);
|
||||
if (IS_ERR(csi2_dev->reset)) {
|
||||
dev_err(dev, "failed to get reset controller\n");
|
||||
return PTR_ERR(csi2_dev->reset);
|
||||
ret = PTR_ERR(csi2_dev->reset);
|
||||
goto error_clock_rate_exclusive;
|
||||
}
|
||||
|
||||
/* D-PHY */
|
||||
|
|
@ -741,7 +744,7 @@ sun8i_a83t_mipi_csi2_resources_setup(struct sun8i_a83t_mipi_csi2_device *csi2_de
|
|||
ret = sun8i_a83t_dphy_register(csi2_dev);
|
||||
if (ret) {
|
||||
dev_err(dev, "failed to initialize MIPI D-PHY\n");
|
||||
return ret;
|
||||
goto error_clock_rate_exclusive;
|
||||
}
|
||||
|
||||
/* Runtime PM */
|
||||
|
|
@ -749,6 +752,11 @@ sun8i_a83t_mipi_csi2_resources_setup(struct sun8i_a83t_mipi_csi2_device *csi2_de
|
|||
pm_runtime_enable(dev);
|
||||
|
||||
return 0;
|
||||
|
||||
error_clock_rate_exclusive:
|
||||
clk_rate_exclusive_put(csi2_dev->clock_mod);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -778,9 +786,14 @@ static int sun8i_a83t_mipi_csi2_probe(struct platform_device *platform_dev)
|
|||
|
||||
ret = sun8i_a83t_mipi_csi2_bridge_setup(csi2_dev);
|
||||
if (ret)
|
||||
return ret;
|
||||
goto error_resources;
|
||||
|
||||
return 0;
|
||||
|
||||
error_resources:
|
||||
sun8i_a83t_mipi_csi2_resources_cleanup(csi2_dev);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int sun8i_a83t_mipi_csi2_remove(struct platform_device *platform_dev)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user