]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
NTB: hw: amd: fix an issue about leak system resources
authorKaige Li <likaige@loongson.cn>
Tue, 11 Aug 2020 01:59:57 +0000 (09:59 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 29 Oct 2020 08:58:00 +0000 (09:58 +0100)
[ Upstream commit 44a0a3c17919db1498cebb02ecf3cf4abc1ade7b ]

The related system resources were not released when pci_set_dma_mask(),
pci_set_consistent_dma_mask(), or pci_iomap() return error in the
amd_ntb_init_pci() function. Add pci_release_regions() to fix it.

Fixes: a1b3695820aa ("NTB: Add support for AMD PCI-Express Non-Transparent Bridge")
Signed-off-by: Kaige Li <likaige@loongson.cn>
Signed-off-by: Jon Mason <jdmason@kudzu.us>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/ntb/hw/amd/ntb_hw_amd.c

index 156c2a18a239458d0f81f9eb82d9db367db2d52d..abb37659de3437fc92d0c2c37c32024792561c5f 100644 (file)
@@ -1036,6 +1036,7 @@ static int amd_ntb_init_pci(struct amd_ntb_dev *ndev,
 
 err_dma_mask:
        pci_clear_master(pdev);
+       pci_release_regions(pdev);
 err_pci_regions:
        pci_disable_device(pdev);
 err_pci_enable: