Skip to content

Commit

Permalink
pci: don't initialize anything before checking if I/O is enabled
Browse files Browse the repository at this point in the history
Signed-off-by: Brice Goglin <Brice.Goglin@inria.fr>
  • Loading branch information
bgoglin committed Jun 13, 2023
1 parent 263f9bb commit 6ef4413
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions hwloc/topology-pci.c
@@ -1,6 +1,6 @@
/*
* Copyright © 2009 CNRS
* Copyright © 2009-2022 Inria. All rights reserved.
* Copyright © 2009-2023 Inria. All rights reserved.
* Copyright © 2009-2011, 2013 Université Bordeaux
* Copyright © 2014-2018 Cisco Systems, Inc. All rights reserved.
* Copyright © 2015 Research Organization for Information Science
Expand Down Expand Up @@ -146,12 +146,6 @@ hwloc_look_pci(struct hwloc_backend *backend, struct hwloc_disc_status *dstatus)
struct pci_device *pcidev;
struct pci_id_match m;

m.subvendor_id = PCI_MATCH_ANY;
m.subdevice_id = PCI_MATCH_ANY;
m.device_class = 0;
m.device_class_mask = 0;
m.match_data = 0;

hwloc_topology_get_type_filter(topology, HWLOC_OBJ_PCI_DEVICE, &pfilter);
hwloc_topology_get_type_filter(topology, HWLOC_OBJ_BRIDGE, &bfilter);
if (bfilter == HWLOC_TYPE_FILTER_KEEP_NONE
Expand All @@ -166,6 +160,12 @@ hwloc_look_pci(struct hwloc_backend *backend, struct hwloc_disc_status *dstatus)

hwloc_debug("%s", "\nScanning PCI buses...\n");

m.subvendor_id = PCI_MATCH_ANY;
m.subdevice_id = PCI_MATCH_ANY;
m.device_class = 0;
m.device_class_mask = 0;
m.match_data = 0;

/* pciaccess isn't thread-safe. it uses a single global variable that doesn't have
* refcounting, and is dynamically reallocated when vendor/device names are needed, etc.
*/
Expand Down

0 comments on commit 6ef4413

Please sign in to comment.