summaryrefslogtreecommitdiffstats
path: root/drivers/media/platform/cadence
diff options
context:
space:
mode:
authorSakari Ailus2018-05-09 22:24:35 +0200
committerMauro Carvalho Chehab2018-05-17 12:22:08 +0200
commit28d42d2fcaad68fa81a328adfb027323796e5f6e (patch)
tree09aaf3ea0df607b073cdd6b74b8b93ea408f61f0 /drivers/media/platform/cadence
parentmedia: dt-bindings: media: Add Cadence MIPI-CSI2 TX Device Tree bindings (diff)
downloadkernel-qcow2-linux-28d42d2fcaad68fa81a328adfb027323796e5f6e.tar.gz
kernel-qcow2-linux-28d42d2fcaad68fa81a328adfb027323796e5f6e.tar.xz
kernel-qcow2-linux-28d42d2fcaad68fa81a328adfb027323796e5f6e.zip
media: cadence: csi2rx: Fix csi2rx_start error handling
The clocks enabled by csi2rx_start function are intended to be disabled in an error path but there are two issues: 1) the loop condition is always true and 2) the first clock disabled is the the one enabling of which failed. Fix these two bugs by changing the loop condition as well as only disabling the clocks that were actually enabled. Reported-by: Mauro Chehab <mchehab@kernel.org> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Acked-by: Maxime Ripard <maxime.ripard@bootlin.com> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Diffstat (limited to 'drivers/media/platform/cadence')
-rw-r--r--drivers/media/platform/cadence/cdns-csi2rx.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/media/platform/cadence/cdns-csi2rx.c b/drivers/media/platform/cadence/cdns-csi2rx.c
index fe612ec1f99f..a0f02916006b 100644
--- a/drivers/media/platform/cadence/cdns-csi2rx.c
+++ b/drivers/media/platform/cadence/cdns-csi2rx.c
@@ -174,8 +174,8 @@ static int csi2rx_start(struct csi2rx_priv *csi2rx)
return 0;
err_disable_pixclk:
- for (; i >= 0; i--)
- clk_disable_unprepare(csi2rx->pixel_clk[i]);
+ for (; i > 0; i--)
+ clk_disable_unprepare(csi2rx->pixel_clk[i - 1]);
err_disable_pclk:
clk_disable_unprepare(csi2rx->p_clk);