Skip to content

Commit

Permalink
media: v4l: cadence: Handle errors of clk_prepare_enable()
Browse files Browse the repository at this point in the history
Handle errors of clk_prepare_enable() in csi2rx_get_resources().

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>
  • Loading branch information
eunovm authored and mchehab committed Jun 2, 2021
1 parent 5ef8a20 commit cca65f6
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion drivers/media/platform/cadence/cdns-csi2rx.c
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,7 @@ static int csi2rx_get_resources(struct csi2rx_priv *csi2rx,
struct resource *res;
unsigned char i;
u32 dev_cfg;
int ret;

res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
csi2rx->base = devm_ioremap_resource(&pdev->dev, res);
Expand Down Expand Up @@ -315,7 +316,12 @@ static int csi2rx_get_resources(struct csi2rx_priv *csi2rx,
return -EINVAL;
}

clk_prepare_enable(csi2rx->p_clk);
ret = clk_prepare_enable(csi2rx->p_clk);
if (ret) {
dev_err(&pdev->dev, "Couldn't prepare and enable P clock\n");
return ret;
}

dev_cfg = readl(csi2rx->base + CSI2RX_DEVICE_CFG_REG);
clk_disable_unprepare(csi2rx->p_clk);

Expand Down

0 comments on commit cca65f6

Please sign in to comment.