[PATCH v3 2/4] drivers/thermal/exymos: Remove redundant IS_ERR() checks for clk_sec clock

From: Anand Moon
Date: Sun Feb 16 2025 - 14:59:46 EST


Remove unnecessary IS_ERR() checks for the clk_sec clock,
the clk_enable() and clk_disable() functions can handle NULL clock
pointers, so the additional checks are redundant and have been removed
to simplify the code.

Signed-off-by: Anand Moon <linux.amoon@xxxxxxxxx>
---
v3: improve the commit message
---
drivers/thermal/samsung/exynos_tmu.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c
index 9c138772d380..8d26000c73aa 100644
--- a/drivers/thermal/samsung/exynos_tmu.c
+++ b/drivers/thermal/samsung/exynos_tmu.c
@@ -258,8 +258,7 @@ static int exynos_tmu_initialize(struct platform_device *pdev)

mutex_lock(&data->lock);
clk_enable(data->clk);
- if (!IS_ERR(data->clk_sec))
- clk_enable(data->clk_sec);
+ clk_enable(data->clk_sec);

status = readb(data->base + EXYNOS_TMU_REG_STATUS);
if (!status) {
@@ -269,8 +268,7 @@ static int exynos_tmu_initialize(struct platform_device *pdev)
data->tmu_clear_irqs(data);
}

- if (!IS_ERR(data->clk_sec))
- clk_disable(data->clk_sec);
+ clk_disable(data->clk_sec);
clk_disable(data->clk);
mutex_unlock(&data->lock);

@@ -1115,8 +1113,7 @@ static int exynos_tmu_probe(struct platform_device *pdev)
err_clk:
clk_unprepare(data->clk);
err_clk_sec:
- if (!IS_ERR(data->clk_sec))
- clk_unprepare(data->clk_sec);
+ clk_unprepare(data->clk_sec);
return ret;
}

@@ -1128,8 +1125,7 @@ static void exynos_tmu_remove(struct platform_device *pdev)

clk_disable_unprepare(data->sclk);
clk_unprepare(data->clk);
- if (!IS_ERR(data->clk_sec))
- clk_unprepare(data->clk_sec);
+ clk_unprepare(data->clk_sec);
}

#ifdef CONFIG_PM_SLEEP
--
2.48.1