mirror of https://gitee.com/openkylin/linux.git
media: imx7-media-csi: Check the return value from clk_prepare_enable()
clk_prepare_enable() may fail, so we should better check its return value and propagate it in the case of error. Signed-off-by: Fabio Estevam <festevam@gmail.com> Tested-by: Rui Miguel Silva <rmfrfs@gmail.com> Reviewed-by: Rui Miguel Silva <rmfrfs@gmail.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
This commit is contained in:
parent
964fcacddf
commit
ddfb2982ec
|
@ -390,17 +390,23 @@ static void imx7_csi_error_recovery(struct imx7_csi *csi)
|
||||||
imx7_csi_hw_enable(csi);
|
imx7_csi_hw_enable(csi);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void imx7_csi_init(struct imx7_csi *csi)
|
static int imx7_csi_init(struct imx7_csi *csi)
|
||||||
{
|
{
|
||||||
if (csi->is_init)
|
int ret;
|
||||||
return;
|
|
||||||
|
|
||||||
clk_prepare_enable(csi->mclk);
|
if (csi->is_init)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
ret = clk_prepare_enable(csi->mclk);
|
||||||
|
if (ret < 0)
|
||||||
|
return ret;
|
||||||
imx7_csi_hw_reset(csi);
|
imx7_csi_hw_reset(csi);
|
||||||
imx7_csi_init_interface(csi);
|
imx7_csi_init_interface(csi);
|
||||||
imx7_csi_dmareq_rff_enable(csi);
|
imx7_csi_dmareq_rff_enable(csi);
|
||||||
|
|
||||||
csi->is_init = true;
|
csi->is_init = true;
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void imx7_csi_deinit(struct imx7_csi *csi)
|
static void imx7_csi_deinit(struct imx7_csi *csi)
|
||||||
|
@ -513,7 +519,7 @@ static int imx7_csi_link_setup(struct media_entity *entity,
|
||||||
|
|
||||||
init:
|
init:
|
||||||
if (csi->sink || csi->src_sd)
|
if (csi->sink || csi->src_sd)
|
||||||
imx7_csi_init(csi);
|
ret = imx7_csi_init(csi);
|
||||||
else
|
else
|
||||||
imx7_csi_deinit(csi);
|
imx7_csi_deinit(csi);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue