]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commit
Input: omap4-keypad - fix runtime PM error handling
authorZhang Qilong <zhangqilong3@huawei.com>
Sat, 21 Nov 2020 00:36:49 +0000 (16:36 -0800)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Wed, 20 Jan 2021 13:25:46 +0000 (14:25 +0100)
commit187ac5fb4a3c401f8b0807474bcdb9cc718178cb
tree777cdcd6d02bda906eef5efbb1504d05fe53146c
parent79f897e40ec6f0c1c8e8eb93de272ec240c3d8b9
Input: omap4-keypad - fix runtime PM error handling

BugLink: https://bugs.launchpad.net/bugs/1910822
[ Upstream commit 59bbf83835f591b95c3bdd09d900f3584fa227af ]

In omap4_keypad_probe, the patch fix several bugs.

  1) pm_runtime_get_sync will increment pm usage counter even it
     failed. Forgetting to pm_runtime_put_noidle will result in
     reference leak.

  2) In err_unmap, forget to disable runtime of device,
     pm_runtime_enable will increase power disable depth. Thus a
     pairing decrement is needed on the error handling path to keep
     it balanced.

  3) In err_pm_disable, it will call pm_runtime_put_sync twice not
     one time.

To fix this we factor out code reading revision and disabling touchpad, and
drop PM reference once we are done talking to the device.

Fixes: f77621cc640a7 ("Input: omap-keypad - dynamically handle register offsets")
Fixes: 5ad567ffbaf20 ("Input: omap4-keypad - wire up runtime PM handling")
Signed-off-by: Zhang Qilong <zhangqilong3@huawei.com>
Link: https://lore.kernel.org/r/20201120133918.2559681-1-zhangqilong3@huawei.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kelsey Skunberg <kelsey.skunberg@canonical.com>
drivers/input/keyboard/omap4-keypad.c