* [PATCH] Input: fix reference leak in stmfts_input_open
@ 2022-03-17 13:16 Zheng Yongjun
2022-03-21 4:57 ` Dmitry Torokhov
0 siblings, 1 reply; 2+ messages in thread
From: Zheng Yongjun @ 2022-03-17 13:16 UTC (permalink / raw)
To: dmitry.torokhov, mcoquelin.stm32, alexandre.torgue, linux-input,
linux-stm32, linux-arm-kernel, linux-kernel
pm_runtime_get_sync() will increment pm usage counter even it
failed. Forgetting to call pm_runtime_put_noidle will result
in reference leak in stmfts_input_open, so we should fix it.
Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com>
---
drivers/input/touchscreen/stmfts.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/input/touchscreen/stmfts.c b/drivers/input/touchscreen/stmfts.c
index bc11203c9cf7..72e0b767e1ba 100644
--- a/drivers/input/touchscreen/stmfts.c
+++ b/drivers/input/touchscreen/stmfts.c
@@ -339,11 +339,11 @@ static int stmfts_input_open(struct input_dev *dev)
err = pm_runtime_get_sync(&sdata->client->dev);
if (err < 0)
- return err;
+ goto out;
err = i2c_smbus_write_byte(sdata->client, STMFTS_MS_MT_SENSE_ON);
if (err)
- return err;
+ goto out;
mutex_lock(&sdata->mutex);
sdata->running = true;
@@ -366,7 +366,9 @@ static int stmfts_input_open(struct input_dev *dev)
"failed to enable touchkey\n");
}
- return 0;
+out:
+ pm_runtime_put_noidle(&sdata->client->dev);
+ return err;
}
static void stmfts_input_close(struct input_dev *dev)
--
2.17.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] Input: fix reference leak in stmfts_input_open
2022-03-17 13:16 [PATCH] Input: fix reference leak in stmfts_input_open Zheng Yongjun
@ 2022-03-21 4:57 ` Dmitry Torokhov
0 siblings, 0 replies; 2+ messages in thread
From: Dmitry Torokhov @ 2022-03-21 4:57 UTC (permalink / raw)
To: Zheng Yongjun
Cc: mcoquelin.stm32, alexandre.torgue, linux-input, linux-stm32,
linux-arm-kernel, linux-kernel
On Thu, Mar 17, 2022 at 01:16:04PM +0000, Zheng Yongjun wrote:
> pm_runtime_get_sync() will increment pm usage counter even it
> failed. Forgetting to call pm_runtime_put_noidle will result
> in reference leak in stmfts_input_open, so we should fix it.
>
> Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com>
Applied, thank you.
--
Dmitry
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-03-21 4:59 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-17 13:16 [PATCH] Input: fix reference leak in stmfts_input_open Zheng Yongjun
2022-03-21 4:57 ` Dmitry Torokhov
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).