]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
i2c: stm32f7: fix reference leak when pm_runtime_get_sync fails
authorQinglang Miao <miaoqinglang@huawei.com>
Tue, 1 Dec 2020 09:31:45 +0000 (17:31 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 14 May 2021 08:50:09 +0000 (10:50 +0200)
commitd791b90f5c5e5aa8ccf9e33386c16bd2b7e333a4
tree5043fb56569d46868f175217d601567437578e7f
parent9223505e938ba3db5907e058f4209770cff2f2a7
i2c: stm32f7: fix reference leak when pm_runtime_get_sync fails

[ Upstream commit 2c662660ce2bd3b09dae21a9a9ac9395e1e6c00b ]

The PM reference count is not expected to be incremented on
return in these stm32f7_i2c_xx serious functions.

However, pm_runtime_get_sync will increment the PM reference
count even failed. Forgetting to putting operation will result
in a reference leak here.

Replace it with pm_runtime_resume_and_get to keep usage
counter balanced.

Fixes: ea6dd25deeb5 ("i2c: stm32f7: add PM_SLEEP suspend/resume support")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Qinglang Miao <miaoqinglang@huawei.com>
Signed-off-by: Wolfram Sang <wsa@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/i2c/busses/i2c-stm32f7.c