VMCI: Fix an error handling path in vmci_guest_probe_device()
After a successful pci_iomap_range() call, pci_iounmap() should be called in the error handling path, as already done in the remove function. Add the missing call. The corresponding call was added in the remove function in commit5ee109828e("VMCI: dma dg: allocate send and receive buffers for DMA datagrams") Fixes:e283a0e8b7("VMCI: dma dg: add MMIO access to registers") Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Acked-by: Vishnu Dasa <vishnu.dasa@broadcom.com> Link: https://lore.kernel.org/r/a35bbc3876ae1da70e49dafde4435750e1477be3.1713961553.git.christophe.jaillet@wanadoo.fr Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
d629cfcfed
commit
73df3d6f2e
@@ -625,7 +625,8 @@ static int vmci_guest_probe_device(struct pci_dev *pdev,
|
||||
if (!vmci_dev) {
|
||||
dev_err(&pdev->dev,
|
||||
"Can't allocate memory for VMCI device\n");
|
||||
return -ENOMEM;
|
||||
error = -ENOMEM;
|
||||
goto err_unmap_mmio_base;
|
||||
}
|
||||
|
||||
vmci_dev->dev = &pdev->dev;
|
||||
@@ -642,7 +643,8 @@ static int vmci_guest_probe_device(struct pci_dev *pdev,
|
||||
if (!vmci_dev->tx_buffer) {
|
||||
dev_err(&pdev->dev,
|
||||
"Can't allocate memory for datagram tx buffer\n");
|
||||
return -ENOMEM;
|
||||
error = -ENOMEM;
|
||||
goto err_unmap_mmio_base;
|
||||
}
|
||||
|
||||
vmci_dev->data_buffer = dma_alloc_coherent(&pdev->dev, VMCI_DMA_DG_BUFFER_SIZE,
|
||||
@@ -893,6 +895,10 @@ err_free_notification_bitmap:
|
||||
err_free_data_buffers:
|
||||
vmci_free_dg_buffers(vmci_dev);
|
||||
|
||||
err_unmap_mmio_base:
|
||||
if (mmio_base != NULL)
|
||||
pci_iounmap(pdev, mmio_base);
|
||||
|
||||
/* The rest are managed resources and will be freed by PCI core */
|
||||
return error;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user