[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <162403222216.19906.916681281934309111.tip-bot2@tip-bot2>
Date: Fri, 18 Jun 2021 16:03:42 -0000
From: "tip-bot2 for Krzysztof Kozlowski" <tip-bot2@...utronix.de>
To: linux-tip-commits@...r.kernel.org
Cc: Krzysztof Kozlowski <krzysztof.kozlowski@...onical.com>,
Daniel Lezcano <daniel.lezcano@...aro.org>, x86@...nel.org,
linux-kernel@...r.kernel.org
Subject: [tip: timers/core] clocksource/drivers/samsung_pwm: Cleanup on init error
The following commit has been merged into the timers/core branch of tip:
Commit-ID: 63e83bd8cd848a3d1b4777d90635a309fa9cb2c7
Gitweb: https://git.kernel.org/tip/63e83bd8cd848a3d1b4777d90635a309fa9cb2c7
Author: Krzysztof Kozlowski <krzysztof.kozlowski@...onical.com>
AuthorDate: Thu, 06 May 2021 16:27:27 -04:00
Committer: Daniel Lezcano <daniel.lezcano@...aro.org>
CommitterDate: Fri, 04 Jun 2021 10:12:12 +02:00
clocksource/drivers/samsung_pwm: Cleanup on init error
Failure of timer initialization is likely to be fatal for the system, so
cleanup in such case is not strictly necessary. However the code might
be refactored or reused, so better not to rely on such assumption that
system won't continue init failure.
Unmap the IO memory and put the clock on initialization failures from
devicetree.
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@...onical.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@...aro.org>
Link: https://lore.kernel.org/r/20210506202729.157260-3-krzysztof.kozlowski@canonical.com
---
drivers/clocksource/samsung_pwm_timer.c | 20 +++++++++++++++++---
1 file changed, 17 insertions(+), 3 deletions(-)
diff --git a/drivers/clocksource/samsung_pwm_timer.c b/drivers/clocksource/samsung_pwm_timer.c
index bfad61b..55e2f9f 100644
--- a/drivers/clocksource/samsung_pwm_timer.c
+++ b/drivers/clocksource/samsung_pwm_timer.c
@@ -421,7 +421,7 @@ static int __init samsung_pwm_alloc(struct device_node *np,
struct property *prop;
const __be32 *cur;
u32 val;
- int i;
+ int i, ret;
memcpy(&pwm.variant, variant, sizeof(pwm.variant));
for (i = 0; i < SAMSUNG_PWM_NUM; ++i)
@@ -444,10 +444,24 @@ static int __init samsung_pwm_alloc(struct device_node *np,
pwm.timerclk = of_clk_get_by_name(np, "timers");
if (IS_ERR(pwm.timerclk)) {
pr_crit("failed to get timers clock for timer\n");
- return PTR_ERR(pwm.timerclk);
+ ret = PTR_ERR(pwm.timerclk);
+ goto err_clk;
}
- return _samsung_pwm_clocksource_init();
+ ret = _samsung_pwm_clocksource_init();
+ if (ret)
+ goto err_clocksource;
+
+ return 0;
+
+err_clocksource:
+ clk_put(pwm.timerclk);
+ pwm.timerclk = NULL;
+err_clk:
+ iounmap(pwm.base);
+ pwm.base = NULL;
+
+ return ret;
}
static const struct samsung_pwm_variant s3c24xx_variant = {
Powered by blists - more mailing lists