]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
media: cadence: csi2rx: Fix csi2rx_start error handling
authorSakari Ailus <sakari.ailus@linux.intel.com>
Wed, 9 May 2018 20:24:35 +0000 (16:24 -0400)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Thu, 17 May 2018 10:22:08 +0000 (06:22 -0400)
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>
drivers/media/platform/cadence/cdns-csi2rx.c

index fe612ec1f99f16a1f4d99d7d289f68550bb78731..a0f02916006b49c3b4e4cc7d73d5df9cc1fac7b0 100644 (file)
@@ -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);