Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 commit
5ee109828e73 ("VMCI: dma dg: allocate send and receive buffers for DMA
datagrams")

Fixes: e283a0e8b7ea ("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>

authored by

Christophe JAILLET and committed by
Greg Kroah-Hartman
73df3d6f d629cfcf

+8 -2
+8 -2
drivers/misc/vmw_vmci/vmci_guest.c
··· 625 625 if (!vmci_dev) { 626 626 dev_err(&pdev->dev, 627 627 "Can't allocate memory for VMCI device\n"); 628 - return -ENOMEM; 628 + error = -ENOMEM; 629 + goto err_unmap_mmio_base; 629 630 } 630 631 631 632 vmci_dev->dev = &pdev->dev; ··· 643 642 if (!vmci_dev->tx_buffer) { 644 643 dev_err(&pdev->dev, 645 644 "Can't allocate memory for datagram tx buffer\n"); 646 - return -ENOMEM; 645 + error = -ENOMEM; 646 + goto err_unmap_mmio_base; 647 647 } 648 648 649 649 vmci_dev->data_buffer = dma_alloc_coherent(&pdev->dev, VMCI_DMA_DG_BUFFER_SIZE, ··· 894 892 895 893 err_free_data_buffers: 896 894 vmci_free_dg_buffers(vmci_dev); 895 + 896 + err_unmap_mmio_base: 897 + if (mmio_base != NULL) 898 + pci_iounmap(pdev, mmio_base); 897 899 898 900 /* The rest are managed resources and will be freed by PCI core */ 899 901 return error;