]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commitdiff
Input: imx6ul_tsc - clean up some errors in imx6ul_tsc_resume()
authorDan Carpenter <dan.carpenter@oracle.com>
Mon, 14 Sep 2020 17:17:01 +0000 (10:17 -0700)
committerStefan Bader <stefan.bader@canonical.com>
Mon, 9 Nov 2020 13:49:03 +0000 (14:49 +0100)
BugLink: https://bugs.launchpad.net/bugs/1902115
[ Upstream commit 30df23c5ecdfb8da5b0bc17ceef67eff9e1b0957 ]

If imx6ul_tsc_init() fails then we need to clean up the clocks.

I reversed the "if (input_dev->users) {" condition to make the code a
bit simpler.

Fixes: 6cc527b05847 ("Input: imx6ul_tsc - propagate the errors")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/20200905124942.GC183976@mwanda
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Ian May <ian.may@canonical.com>
drivers/input/touchscreen/imx6ul_tsc.c

index 9ed258854349bf541a0df83c21e7fbffbe459b36..5e6ba5c4eca2a7d98c519d734de052fcc3797acb 100644 (file)
@@ -530,20 +530,25 @@ static int __maybe_unused imx6ul_tsc_resume(struct device *dev)
 
        mutex_lock(&input_dev->mutex);
 
-       if (input_dev->users) {
-               retval = clk_prepare_enable(tsc->adc_clk);
-               if (retval)
-                       goto out;
-
-               retval = clk_prepare_enable(tsc->tsc_clk);
-               if (retval) {
-                       clk_disable_unprepare(tsc->adc_clk);
-                       goto out;
-               }
+       if (!input_dev->users)
+               goto out;
 
-               retval = imx6ul_tsc_init(tsc);
+       retval = clk_prepare_enable(tsc->adc_clk);
+       if (retval)
+               goto out;
+
+       retval = clk_prepare_enable(tsc->tsc_clk);
+       if (retval) {
+               clk_disable_unprepare(tsc->adc_clk);
+               goto out;
        }
 
+       retval = imx6ul_tsc_init(tsc);
+       if (retval) {
+               clk_disable_unprepare(tsc->tsc_clk);
+               clk_disable_unprepare(tsc->adc_clk);
+               goto out;
+       }
 out:
        mutex_unlock(&input_dev->mutex);
        return retval;