dmaengine: usb-dmac: Fix PM reference leak in usb_dmac_probe()
authorYu Kuai <yukuai3@huawei.com>
Tue, 6 Jul 2021 12:45:21 +0000 (20:45 +0800)
committerSasha Levin <sashal@kernel.org>
Thu, 26 Aug 2021 12:35:35 +0000 (08:35 -0400)
commitb618a32142c727c6d20240cc174900f1c08a71f9
tree55fb0dc4cec45b27ab56021b4d62e2f65f55c9d5
parentc160df90b0ca35341341ee19d2430c9fb8847bfa
dmaengine: usb-dmac: Fix PM reference leak in usb_dmac_probe()

[ Upstream commit 1da569fa7ec8cb0591c74aa3050d4ea1397778b4 ]

pm_runtime_get_sync will increment pm usage counter even it failed.
Forgetting to putting operation will result in reference leak here.
Fix it by moving the error_pm label above the pm_runtime_put() in
the error path.

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Yu Kuai <yukuai3@huawei.com>
Link: https://lore.kernel.org/r/20210706124521.1371901-1-yukuai3@huawei.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/dma/sh/usb-dmac.c