]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commit
soc: ti: Fix reference imbalance in knav_dma_probe
authorZhang Qilong <zhangqilong3@huawei.com>
Sun, 22 Nov 2020 03:22:37 +0000 (19:22 -0800)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Wed, 20 Jan 2021 13:25:46 +0000 (14:25 +0100)
commit50d80bb4b68af7c3eda80dd75dd32b5f16c9771c
treede7c4a32b97658fd7b919e4724257f1c0128770c
parent60ebdc0d68930c488702e376d9ed7036ece6dd41
soc: ti: Fix reference imbalance in knav_dma_probe

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

The patch fix two reference leak.

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

  2) The pm_runtime_enable will increase power disable depth. Thus
     a pairing decrement is needed on the error handling path to
     keep it balanced.

We fix it by: 1) adding call pm_runtime_put_noidle or
pm_runtime_put_sync in error handling. 2) adding pm_runtime_disable
in error handling, to keep usage counter and disable depth balanced.

Fixes: 88139ed030583 ("soc: ti: add Keystone Navigator DMA support")
Signed-off-by: Zhang Qilong <zhangqilong3@huawei.com>
Signed-off-by: Santosh Shilimkar <santosh.shilimkar@oracle.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/soc/ti/knav_dma.c