summaryrefslogtreecommitdiff
path: root/drivers/tty/serial
diff options
context:
space:
mode:
authorArtem Shimko <a.shimko.dev@gmail.com>2025-11-04 17:54:25 +0300
committerSasha Levin <sashal@kernel.org>2026-03-04 07:21:23 -0500
commit3590c1751c1d3969ee765568adbc359f459408c5 (patch)
treee37e51eea9557ab0ef216ea5a39511f22bcbbd43 /drivers/tty/serial
parent98d6bdb521f2c9961afac6d33eb722207d1e2c1d (diff)
downloadlinux-3590c1751c1d3969ee765568adbc359f459408c5.tar.gz
linux-3590c1751c1d3969ee765568adbc359f459408c5.tar.bz2
linux-3590c1751c1d3969ee765568adbc359f459408c5.zip
serial: 8250_dw: handle clock enable errors in runtime_resume
[ Upstream commit d31228143a489ba6ba797896a07541ce06828c09 ] Add error checking for clk_prepare_enable() calls in dw8250_runtime_resume(). Currently if either clock fails to enable, the function returns success while leaving clocks in inconsistent state. This change implements comprehensive error handling by checking the return values of both clk_prepare_enable() calls. If the second clock enable operation fails after the first clock has already been successfully enabled, the code now properly cleans up by disabling and unpreparing the first clock before returning. The error code is then propagated to the caller, ensuring that clock enable failures are properly reported rather than being silently ignored. Signed-off-by: Artem Shimko <a.shimko.dev@gmail.com> Link: https://patch.msgid.link/20251104145433.2316165-2-a.shimko.dev@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/tty/serial')
-rw-r--r--drivers/tty/serial/8250/8250_dw.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c
index 83d186c038cd..f17dc3de020c 100644
--- a/drivers/tty/serial/8250/8250_dw.c
+++ b/drivers/tty/serial/8250/8250_dw.c
@@ -718,11 +718,18 @@ static int dw8250_runtime_suspend(struct device *dev)
static int dw8250_runtime_resume(struct device *dev)
{
+ int ret;
struct dw8250_data *data = dev_get_drvdata(dev);
- clk_prepare_enable(data->pclk);
+ ret = clk_prepare_enable(data->pclk);
+ if (ret)
+ return ret;
- clk_prepare_enable(data->clk);
+ ret = clk_prepare_enable(data->clk);
+ if (ret) {
+ clk_disable_unprepare(data->pclk);
+ return ret;
+ }
return 0;
}