Input: stmfts - do not leave device disabled in stmfts_input_open
authorDmitry Torokhov <dmitry.torokhov@gmail.com>
Wed, 25 May 2022 16:51:08 +0000 (09:51 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 9 Jun 2022 08:21:18 +0000 (10:21 +0200)
commitbaf86afed74548adf3e8623ce8592edc8caa5cd3
tree0f9149ee1f2b0d323507a88bc167cb41d70e716d
parentfc0750e659db7b315bf6348902cc8ca3cdd4b8d8
Input: stmfts - do not leave device disabled in stmfts_input_open

[ Upstream commit 5f76955ab1e43e5795a9631b22ca4f918a0ae986 ]

The commit 26623eea0da3 attempted to deal with potential leak of runtime
PM counter when opening the touchscreen device, however it ended up
erroneously dropping the counter in the case of successfully enabling the
device.

Let's address this by using pm_runtime_resume_and_get() and then executing
pm_runtime_put_sync() only when we fail to send "sense on" command to the
device.

Fixes: 26623eea0da3 ("Input: stmfts - fix reference leak in stmfts_input_open")
Reported-by: Pavel Machek <pavel@denx.de>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/input/touchscreen/stmfts.c