[PATCH] Input: mpr121 - propagate suspend and resume write errors

From: Zhu Jun

Date: Thu Nov 12 2026 - 02:21:09 EST


The power management callbacks ignore failures when disabling and
re-enabling the touch electrodes. A failed resume write can leave
the keyboard disabled while the PM core is told that resume succeeded.

Return the SMBus write result from both callbacks.

Fixes: 36682b81de32 ("Input: add driver FSL MPR121 capacitive touch sensor")
Signed-off-by: Zhu Jun <zhujun2@xxxxxxxxxxxxxxxxxxxx>
---
drivers/input/keyboard/mpr121_touchkey.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/input/keyboard/mpr121_touchkey.c b/drivers/input/keyboard/mpr121_touchkey.c
index 06329cf5c749..973fbc5521a8 100644
--- a/drivers/input/keyboard/mpr121_touchkey.c
+++ b/drivers/input/keyboard/mpr121_touchkey.c
@@ -302,9 +302,7 @@ static int mpr_suspend(struct device *dev)
{
struct i2c_client *client = to_i2c_client(dev);

- i2c_smbus_write_byte_data(client, ELECTRODE_CONF_ADDR, 0x00);
-
- return 0;
+ return i2c_smbus_write_byte_data(client, ELECTRODE_CONF_ADDR, 0x00);
}

static int mpr_resume(struct device *dev)
@@ -312,10 +310,8 @@ static int mpr_resume(struct device *dev)
struct i2c_client *client = to_i2c_client(dev);
struct mpr121_touchkey *mpr121 = i2c_get_clientdata(client);

- i2c_smbus_write_byte_data(client, ELECTRODE_CONF_ADDR,
+ return i2c_smbus_write_byte_data(client, ELECTRODE_CONF_ADDR,
mpr121->keycount);
-
- return 0;
}

static DEFINE_SIMPLE_DEV_PM_OPS(mpr121_touchkey_pm_ops, mpr_suspend, mpr_resume);
--
2.51.0