From: Dejin Zheng <zhengdej...@gmail.com>

[ Upstream commit 191f6b08bfef24e1a9641eaac96ed030a7be4599 ]

the related system resources were not released when pci_iomap() return
error in the rtw_pci_io_mapping() function. add pci_release_regions() to
fix it.

Fixes: e3037485c68ec1a ("rtw88: new Realtek 802.11ac driver")
Cc: Andy Shevchenko <andy.shevche...@gmail.com>
Signed-off-by: Dejin Zheng <zhengdej...@gmail.com>
Acked-by: Yan-Hsuan Chuang <yhchu...@realtek.com>
Signed-off-by: Kalle Valo <kv...@codeaurora.org>
Link: https://lore.kernel.org/r/20200504083442.3033-1-zhengdej...@gmail.com
Signed-off-by: Sasha Levin <sas...@kernel.org>
---
 drivers/net/wireless/realtek/rtw88/pci.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/wireless/realtek/rtw88/pci.c 
b/drivers/net/wireless/realtek/rtw88/pci.c
index 1af87eb2e53a..d735f3127fe8 100644
--- a/drivers/net/wireless/realtek/rtw88/pci.c
+++ b/drivers/net/wireless/realtek/rtw88/pci.c
@@ -1091,6 +1091,7 @@ static int rtw_pci_io_mapping(struct rtw_dev *rtwdev,
        len = pci_resource_len(pdev, bar_id);
        rtwpci->mmap = pci_iomap(pdev, bar_id, len);
        if (!rtwpci->mmap) {
+               pci_release_regions(pdev);
                rtw_err(rtwdev, "failed to map pci memory\n");
                return -ENOMEM;
        }
-- 
2.25.1



Reply via email to