summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/pci/pci.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c
index e68226b8cbd..8483da534db 100644
--- a/sys/dev/pci/pci.c
+++ b/sys/dev/pci/pci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pci.c,v 1.46 2006/07/04 18:07:29 kettenis Exp $ */
+/* $OpenBSD: pci.c,v 1.47 2006/10/04 19:27:44 kettenis Exp $ */
/* $NetBSD: pci.c,v 1.31 1997/06/06 23:48:04 thorpej Exp $ */
/*
@@ -518,9 +518,9 @@ int
pciioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
{
struct pci_io *io;
- int error;
+ int i, error;
pcitag_t tag;
- struct pci_softc *pci;
+ struct pci_softc *pci = NULL;
pci_chipset_tag_t pc;
io = (struct pci_io *)data;
@@ -530,12 +530,12 @@ pciioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
PCIDEBUG((" bus %d dev %d func %d reg %x\n", io->pi_sel.pc_bus,
io->pi_sel.pc_dev, io->pi_sel.pc_func, io->pi_reg));
- if (io->pi_sel.pc_bus >= pci_cd.cd_ndevs) {
- error = ENXIO;
- goto done;
+ for (i = 0; i < pci_cd.cd_ndevs; i++) {
+ pci = pci_cd.cd_devs[i];
+ if (pci != NULL && pci->sc_bus == io->pi_sel.pc_bus)
+ break;
}
- pci = pci_cd.cd_devs[io->pi_sel.pc_bus];
- if (pci != NULL) {
+ if (pci != NULL && pci->sc_bus == io->pi_sel.pc_bus) {
pc = pci->sc_pc;
} else {
error = ENXIO;
@@ -549,7 +549,7 @@ pciioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct proc *p)
goto done;
}
- tag = pci_make_tag(pc, pci->sc_bus, io->pi_sel.pc_dev,
+ tag = pci_make_tag(pc, io->pi_sel.pc_bus, io->pi_sel.pc_dev,
io->pi_sel.pc_func);
switch(cmd) {