summaryrefslogtreecommitdiffstats
path: root/src/vlib/linux/pci.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/vlib/linux/pci.c')
-rw-r--r--src/vlib/linux/pci.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/vlib/linux/pci.c b/src/vlib/linux/pci.c
index 8af1cdab0d4..722fb888117 100644
--- a/src/vlib/linux/pci.c
+++ b/src/vlib/linux/pci.c
@@ -1137,7 +1137,7 @@ vlib_pci_map_region_int (vlib_main_t * vm, vlib_pci_dev_handle_t h,
if (*result == (void *) -1)
{
error = clib_error_return_unix (0, "mmap `BAR%u'", bar);
- if (p->type == LINUX_PCI_DEVICE_TYPE_UIO)
+ if (p->type == LINUX_PCI_DEVICE_TYPE_UIO && (fd != -1))
close (fd);
return error;
}