提交 b3089c77 编写于 作者: Z Zheng Yongjun 提交者: Zheng Zengkai

Input: stmfts - fix reference leak in stmfts_input_open

stable inclusion
from stable-v5.10.118
commit 5565fc538ded8961c9d885ad37200ee72a7bd1a2
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I5L686

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=5565fc538ded8961c9d885ad37200ee72a7bd1a2

--------------------------------

[ Upstream commit 26623eea ]

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: NZheng Yongjun <zhengyongjun3@huawei.com>
Link: https://lore.kernel.org/r/20220317131604.53538-1-zhengyongjun3@huawei.comSigned-off-by: NDmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
Acked-by: NXie XiuQi <xiexiuqi@huawei.com>
上级 a273c3f3
...@@ -339,11 +339,11 @@ static int stmfts_input_open(struct input_dev *dev) ...@@ -339,11 +339,11 @@ static int stmfts_input_open(struct input_dev *dev)
err = pm_runtime_get_sync(&sdata->client->dev); err = pm_runtime_get_sync(&sdata->client->dev);
if (err < 0) if (err < 0)
return err; goto out;
err = i2c_smbus_write_byte(sdata->client, STMFTS_MS_MT_SENSE_ON); err = i2c_smbus_write_byte(sdata->client, STMFTS_MS_MT_SENSE_ON);
if (err) if (err)
return err; goto out;
mutex_lock(&sdata->mutex); mutex_lock(&sdata->mutex);
sdata->running = true; sdata->running = true;
...@@ -366,7 +366,9 @@ static int stmfts_input_open(struct input_dev *dev) ...@@ -366,7 +366,9 @@ static int stmfts_input_open(struct input_dev *dev)
"failed to enable touchkey\n"); "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) static void stmfts_input_close(struct input_dev *dev)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册