staging: greybus: codecs: Fix reference counter leak in error handling
authorZhang Qilong <zhangqilong3@huawei.com>
Mon, 9 Nov 2020 13:13:46 +0000 (21:13 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 29 Dec 2020 12:46:53 +0000 (13:46 +0100)
commit57080b740dd211892da38520434e6dbd7b0a1ce7
tree02b0741091ad3204cdf51c6b8c60ad5517a3cba2
parent71da483c1d89e2f4153cf86c25e1cbfe7198bc45
staging: greybus: codecs: Fix reference counter leak in error handling

[ Upstream commit 3952659a6108f77a0d062d8e8487bdbdaf52a66c ]

gb_pm_runtime_get_sync has increased the usage counter of the device here.
Forgetting to call gb_pm_runtime_put_noidle will result in usage counter
leak in the error branch of (gbcodec_hw_params and gbcodec_prepare). We
fixed it by adding it.

Fixes: c388ae7696992 ("greybus: audio: Update pm runtime support in dai_ops callback")
Signed-off-by: Zhang Qilong <zhangqilong3@huawei.com>
Link: https://lore.kernel.org/r/20201109131347.1725288-2-zhangqilong3@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/staging/greybus/audio_codec.c