Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Input: imx6ul_tsc - clean up some errors in imx6ul_tsc_resume()

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>

authored by

Dan Carpenter and committed by
Dmitry Torokhov
30df23c5 93f63406

+15 -10
+15 -10
drivers/input/touchscreen/imx6ul_tsc.c
··· 530 530 531 531 mutex_lock(&input_dev->mutex); 532 532 533 - if (input_dev->users) { 534 - retval = clk_prepare_enable(tsc->adc_clk); 535 - if (retval) 536 - goto out; 533 + if (!input_dev->users) 534 + goto out; 537 535 538 - retval = clk_prepare_enable(tsc->tsc_clk); 539 - if (retval) { 540 - clk_disable_unprepare(tsc->adc_clk); 541 - goto out; 542 - } 536 + retval = clk_prepare_enable(tsc->adc_clk); 537 + if (retval) 538 + goto out; 543 539 544 - retval = imx6ul_tsc_init(tsc); 540 + retval = clk_prepare_enable(tsc->tsc_clk); 541 + if (retval) { 542 + clk_disable_unprepare(tsc->adc_clk); 543 + goto out; 545 544 } 546 545 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 + } 547 552 out: 548 553 mutex_unlock(&input_dev->mutex); 549 554 return retval;