[PATCH v2] iio: adc: rockchip_saradc: fix missing clk_disable_unprepare() on error in rockchip_saradc_resume

Qinglang Miao miaoqinglang at huawei.com
Tue Nov 3 02:49:09 EST 2020


Fix the missing clk_disable_unprepare() of info->pclk
before return from rockchip_saradc_resume in the error
handling case when fails to prepare and enable info->clk.

Fixes: 44d6f2ef94f9 ("iio: adc: add driver for Rockchip saradc")
Signed-off-by: Qinglang Miao <miaoqinglang at huawei.com>
---
 drivers/iio/adc/rockchip_saradc.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/adc/rockchip_saradc.c b/drivers/iio/adc/rockchip_saradc.c
index 1f3d7d639..5eb566274 100644
--- a/drivers/iio/adc/rockchip_saradc.c
+++ b/drivers/iio/adc/rockchip_saradc.c
@@ -461,9 +461,10 @@ static int rockchip_saradc_resume(struct device *dev)
 		return ret;
 
 	ret = clk_prepare_enable(info->clk);
-	if (ret)
+	if (ret) {
+		clk_disable_unprepare(info->pclk);
 		return ret;
-
+	}
 	return ret;
 }
 #endif
-- 
2.23.0




More information about the Linux-rockchip mailing list