From: Vasant Hegde <vasant.he...@amd.com>

Unmap old_devtb in error path.

Co-developed-by: Suravee Suthikulpanit <suravee.suthikulpa...@amd.com>
Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpa...@amd.com>
Signed-off-by: Vasant Hegde <vasant.he...@amd.com>
---
 drivers/iommu/amd/init.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/iommu/amd/init.c b/drivers/iommu/amd/init.c
index 770ac679b682..92c489c1467d 100644
--- a/drivers/iommu/amd/init.c
+++ b/drivers/iommu/amd/init.c
@@ -979,6 +979,7 @@ static bool copy_device_table(void)
                                get_order(dev_table_size));
        if (old_dev_tbl_cpy == NULL) {
                pr_err("Failed to allocate memory for copying old device 
table!\n");
+               memunmap(old_devtb);
                return false;
        }
 
@@ -1009,6 +1010,7 @@ static bool copy_device_table(void)
                        if ((int_ctl != DTE_IRQ_REMAP_INTCTL) ||
                            (int_tab_len != DTE_INTTABLEN)) {
                                pr_err("Wrong old irq remapping flag: %#x\n", 
devid);
+                               memunmap(old_devtb);
                                return false;
                        }
 
-- 
2.27.0

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

Reply via email to