Skip to content

Commit

Permalink
Input: stmfts - fix reference leak in stmfts_input_open
Browse files Browse the repository at this point in the history
[ Upstream commit 26623ee ]

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>
Link: https://lore.kernel.org/r/20220317131604.53538-1-zhengyongjun3@huawei.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Zheng Yongjun authored and gregkh committed May 25, 2022
1 parent d5e88c2 commit 5565fc5
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions drivers/input/touchscreen/stmfts.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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)
Expand Down

0 comments on commit 5565fc5

Please sign in to comment.