diff mbox series

input: touchscreen: fix reference leak in stmfts_input_open

Message ID 20210226023946.5168-1-dingsenjie@163.com (mailing list archive)
State New, archived
Headers show
Series input: touchscreen: fix reference leak in stmfts_input_open | expand

Commit Message

dingsenjie@163.com Feb. 26, 2021, 2:39 a.m. UTC
From: dingsenjie <dingsenjie@yulong.com>

pm_runtime_get_sync will increment pm usage counter even it
failed. Forgetting to pm_runtime_put_noidle will result in
reference leak in cedrus_start_streaming.

Signed-off-by: dingsenjie <dingsenjie@yulong.com>
---
 drivers/input/touchscreen/stmfts.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/input/touchscreen/stmfts.c b/drivers/input/touchscreen/stmfts.c
index 9a64e1d..b91a59b 100644
--- a/drivers/input/touchscreen/stmfts.c
+++ b/drivers/input/touchscreen/stmfts.c
@@ -338,8 +338,10 @@  static int stmfts_input_open(struct input_dev *dev)
 	int err;
 
 	err = pm_runtime_get_sync(&sdata->client->dev);
-	if (err < 0)
+	if (err < 0) {
+		pm_runtime_put_noidle(&sdata->client->dev);
 		return err;
+	}
 
 	err = i2c_smbus_write_byte(sdata->client, STMFTS_MS_MT_SENSE_ON);
 	if (err)