Input: imx6ul_tsc - fix error handling
authorFabio Estevam <fabio.estevam@nxp.com>
Wed, 12 Apr 2017 15:33:50 +0000 (08:33 -0700)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Wed, 12 Apr 2017 15:47:17 +0000 (08:47 -0700)
If imx6ul_tsc_init() fails we should not return directly.

We should disable the previously acquired clocks in this case.

Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
drivers/input/touchscreen/imx6ul_tsc.c

index 7098e0a47019539b7cc3482fe3043576a123e348..ee82a975bfd29247768761ec9c8ac1e4d0babaf9 100644 (file)
@@ -337,11 +337,20 @@ static int imx6ul_tsc_open(struct input_dev *input_dev)
                dev_err(tsc->dev,
                        "Could not prepare or enable the tsc clock: %d\n",
                        err);
-               clk_disable_unprepare(tsc->adc_clk);
-               return err;
+               goto disable_adc_clk;
        }
 
-       return imx6ul_tsc_init(tsc);
+       err = imx6ul_tsc_init(tsc);
+       if (err)
+               goto disable_tsc_clk;
+
+       return 0;
+
+disable_tsc_clk:
+       clk_disable_unprepare(tsc->tsc_clk);
+disable_adc_clk:
+       clk_disable_unprepare(tsc->adc_clk);
+       return err;
 }
 
 static void imx6ul_tsc_close(struct input_dev *input_dev)