[PATCH 6/6] serial: qcom-geni: check return value of pm_runtime_resume_and_get()
Praveen Talari
praveen.talari at oss.qualcomm.com
Wed Jul 8 23:25:18 PDT 2026
The .pm uart_ops callback calls pm_runtime_resume_and_get() but
discards its return value. Failures such as -EAGAIN or -EACCES go
unnoticed and the driver continues as though the device is active,
which can lead to register accesses on an unsuspended device.
Check the return value and propagate the error to the caller. The
.pm callback now returns int (since commit 6ffcacf023cb ("tty: serial:
change uart_ops.pm callback to return int")), so returning the error
code is sufficient for the serial core to handle the failure.
Signed-off-by: Praveen Talari <praveen.talari at oss.qualcomm.com>
---
drivers/tty/serial/qcom_geni_serial.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c
index 17ab8acb3b8e..1ed09ac0af0c 100644
--- a/drivers/tty/serial/qcom_geni_serial.c
+++ b/drivers/tty/serial/qcom_geni_serial.c
@@ -1727,14 +1727,19 @@ static int geni_serial_resource_init(struct uart_port *uport)
static int qcom_geni_serial_pm(struct uart_port *uport,
unsigned int new_state, unsigned int old_state)
{
+ int ret;
/* If we've never been called, treat it as off */
if (old_state == UART_PM_STATE_UNDEFINED)
old_state = UART_PM_STATE_OFF;
- if (new_state == UART_PM_STATE_ON && old_state == UART_PM_STATE_OFF)
- pm_runtime_resume_and_get(uport->dev);
- else if (new_state == UART_PM_STATE_OFF &&
+ if (new_state == UART_PM_STATE_ON && old_state == UART_PM_STATE_OFF) {
+ ret = pm_runtime_resume_and_get(uport->dev);
+ if (ret < 0) {
+ dev_err(uport->dev, "Failed to resume and get %d\n", ret);
+ return ret;
+ }
+ } else if (new_state == UART_PM_STATE_OFF &&
old_state == UART_PM_STATE_ON)
pm_runtime_put_sync(uport->dev);
--
2.34.1
More information about the Linux-mediatek
mailing list