linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] input: touchscreen: fix reference leak in stmfts_input_open
@ 2021-02-26  2:39 dingsenjie
  0 siblings, 0 replies; only message in thread
From: dingsenjie @ 2021-02-26  2:39 UTC (permalink / raw)
  To: dmitry.torokhov, mcoquelin.stm32, alexandre.torgue
  Cc: linux-input, linux-kernel, dingsenjie

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 --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



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-02-26  2:58 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-26  2:39 [PATCH] input: touchscreen: fix reference leak in stmfts_input_open dingsenjie

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).