summaryrefslogtreecommitdiff
path: root/drivers/media/platform/cadence/cdns-csi2rx.c
diff options
context:
space:
mode:
authorEvgeny Novikov <novikov@ispras.ru>2021-05-18 20:57:22 +0200
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>2021-06-02 14:04:35 +0200
commitcca65f64045523f923380171bf6d329bfd79970f (patch)
tree16a1c6732af0251c8ddd350cf8de8d4b316b3d56 /drivers/media/platform/cadence/cdns-csi2rx.c
parent5ef8a20af18716f97875714a32266256f6aa6f60 (diff)
media: v4l: cadence: Handle errors of clk_prepare_enable()
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>
Diffstat (limited to 'drivers/media/platform/cadence/cdns-csi2rx.c')
-rw-r--r--drivers/media/platform/cadence/cdns-csi2rx.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/media/platform/cadence/cdns-csi2rx.c b/drivers/media/platform/cadence/cdns-csi2rx.c
index c68a3eac62cd..f2b4ddd31177 100644
--- a/drivers/media/platform/cadence/cdns-csi2rx.c
+++ b/drivers/media/platform/cadence/cdns-csi2rx.c
@@ -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);
@@ -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);