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)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Thu, 26 May 2022 16:57:07 +0000 (09:57 -0700)
commit5f76955ab1e43e5795a9631b22ca4f918a0ae986
tree72da1df9979246b53af0a16ab2534a9b44d77b5e
parentcee409bbba0d1bd3fb73064fb480ff365f453b5d
Input: stmfts - do not leave device disabled in stmfts_input_open

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>
drivers/input/touchscreen/stmfts.c