[PATCH] input: touchscreen: fix reference leak in stmfts_input_open
From: dingsenjie
Date: Thu Feb 25 2021 - 21:58:50 EST
From: dingsenjie <dingsenjie@xxxxxxxxxx>
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@xxxxxxxxxx>
---
drivers/input/touchscreen/stmfts.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
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)
--
1.9.1