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:23:13 +0000 (10:23 +0200)
commit64522155ea73cc580be931f10aa29e3a51f5c6d5
treeff077e783f2a2202f98e3a55faad39163083a8e7
parent4f1c4fa37f8bd0d142d6641db4c82094124f468c
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