Skip to content

Commit 81e5e2c

Browse files
Dan Carpentergregkh
authored andcommitted
Input: imx6ul_tsc - clean up some errors in imx6ul_tsc_resume()
[ Upstream commit 30df23c ] 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: 6cc527b ("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>
1 parent 6498597 commit 81e5e2c

1 file changed

Lines changed: 16 additions & 11 deletions

File tree

‎drivers/input/touchscreen/imx6ul_tsc.c‎

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -530,20 +530,25 @@ static int __maybe_unused imx6ul_tsc_resume(struct device *dev)
530530

531531
mutex_lock(&input_dev->mutex);
532532

533-
if (input_dev->users) {
534-
retval = clk_prepare_enable(tsc->adc_clk);
535-
if (retval)
536-
goto out;
537-
538-
retval = clk_prepare_enable(tsc->tsc_clk);
539-
if (retval) {
540-
clk_disable_unprepare(tsc->adc_clk);
541-
goto out;
542-
}
533+
if (!input_dev->users)
534+
goto out;
543535

544-
retval = imx6ul_tsc_init(tsc);
536+
retval = clk_prepare_enable(tsc->adc_clk);
537+
if (retval)
538+
goto out;
539+
540+
retval = clk_prepare_enable(tsc->tsc_clk);
541+
if (retval) {
542+
clk_disable_unprepare(tsc->adc_clk);
543+
goto out;
545544
}
546545

546+
retval = imx6ul_tsc_init(tsc);
547+
if (retval) {
548+
clk_disable_unprepare(tsc->tsc_clk);
549+
clk_disable_unprepare(tsc->adc_clk);
550+
goto out;
551+
}
547552
out:
548553
mutex_unlock(&input_dev->mutex);
549554
return retval;

0 commit comments

Comments
 (0)