From 774b9a437d4f6d7e2b6b2dfdd3b5e42adff2804c Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Tue, 16 Jul 2002 14:39:28 +0000 Subject: don't do useless stuff when full probe isn't requires: - allocatestuff on stack - call snprintf --- pci.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pci.c b/pci.c index 6787977..1ed5c96 100644 --- a/pci.c +++ b/pci.c @@ -27,11 +27,11 @@ extern struct pciusb_entries pci_probe(int probe_type) { e.pci_bus = devbusfn >> 8; e.pci_device = (devbusfn & 0xff) >> 3; e.pci_function = (devbusfn & 0xff) & 0x07; - { + if (probe_type == 1) { char file[25]; FILE *f; snprintf(file, sizeof(file), "/proc/bus/pci/%02x/%02x.%d", e.pci_bus, e.pci_device, e.pci_function); - if (probe_type == 1 && (f = fopen(file, "r"))) { + if ((f = fopen(file, "r"))) { if (fseek(f, 10, SEEK_SET) == 0) fread(&e.class_, 2, 1, f); if (fseek(f, 0x2c, SEEK_SET) == 0) -- cgit v1.2.1