summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvgeny Novikov <novikov@ispras.ru>2021-05-17 15:49:18 +0300
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>2021-06-02 14:34:38 +0300
commite6001f6922cfda7b76f594595ebb38351c313da2 (patch)
tree557980a9dbccf4dbc987a43ab3a7219d793a6c8f
parent8610b3a2abfd0a043df91ac2754a406d7d42b207 (diff)
downloadlinux-e6001f6922cfda7b76f594595ebb38351c313da2.tar.xz
media: v4l: cadence: Handle errors of clk_prepare_enable()
Handle errors of clk_prepare_enable() in csi2tx_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>
-rw-r--r--drivers/media/platform/cadence/cdns-csi2tx.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/media/platform/cadence/cdns-csi2tx.c b/drivers/media/platform/cadence/cdns-csi2tx.c
index e4d08acfbb49..765ae408970a 100644
--- a/drivers/media/platform/cadence/cdns-csi2tx.c
+++ b/drivers/media/platform/cadence/cdns-csi2tx.c
@@ -436,6 +436,7 @@ static int csi2tx_get_resources(struct csi2tx_priv *csi2tx,
struct resource *res;
unsigned int i;
u32 dev_cfg;
+ int ret;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
csi2tx->base = devm_ioremap_resource(&pdev->dev, res);
@@ -454,7 +455,12 @@ static int csi2tx_get_resources(struct csi2tx_priv *csi2tx,
return PTR_ERR(csi2tx->esc_clk);
}
- clk_prepare_enable(csi2tx->p_clk);
+ ret = clk_prepare_enable(csi2tx->p_clk);
+ if (ret) {
+ dev_err(&pdev->dev, "Couldn't prepare and enable p_clk\n");
+ return ret;
+ }
+
dev_cfg = readl(csi2tx->base + CSI2TX_DEVICE_CONFIG_REG);
clk_disable_unprepare(csi2tx->p_clk);