Commit f1aae40e authored by Ofir Bitton's avatar Ofir Bitton Committed by Oded Gabbay

habanalabs: unmap PCI bars upon iATU failure

In case the driver fails to configure the PCI controller iATU, it needs to
unmap the PCI bars before exiting so if the driver is removed, the bars
won't be left mapped.
Signed-off-by: default avatarOfir Bitton <obitton@habana.ai>
Reviewed-by: default avatarOded Gabbay <oded.gabbay@gmail.com>
Signed-off-by: default avatarOded Gabbay <oded.gabbay@gmail.com>
parent 51072c0f
...@@ -369,15 +369,17 @@ int hl_pci_init(struct hl_device *hdev) ...@@ -369,15 +369,17 @@ int hl_pci_init(struct hl_device *hdev)
rc = hdev->asic_funcs->init_iatu(hdev); rc = hdev->asic_funcs->init_iatu(hdev);
if (rc) { if (rc) {
dev_err(hdev->dev, "Failed to initialize iATU\n"); dev_err(hdev->dev, "Failed to initialize iATU\n");
goto disable_device; goto unmap_pci_bars;
} }
rc = hl_pci_set_dma_mask(hdev); rc = hl_pci_set_dma_mask(hdev);
if (rc) if (rc)
goto disable_device; goto unmap_pci_bars;
return 0; return 0;
unmap_pci_bars:
hl_pci_bars_unmap(hdev);
disable_device: disable_device:
pci_clear_master(pdev); pci_clear_master(pdev);
pci_disable_device(pdev); pci_disable_device(pdev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment