DragonFlyBSD Kernel Audit
DF-2094 / fix.diff
← back to finding ↓ download raw
diff --git a/sys/dev/disk/nata/chipsets/ata-acerlabs.c b/sys/dev/disk/nata/chipsets/ata-acerlabs.c
@@ -147,9 +147,9 @@
     struct ata_channel *ch = device_get_softc(dev);
     struct resource *io = NULL, *ctlio = NULL;
     int unit01 = (ch->unit & 1), unit10 = (ch->unit & 2);
-    int i, rid;
+    int i, rid, io_rid;
 
-    rid = PCIR_BAR(0) + (unit01 ? 8 : 0);
+    io_rid = rid = PCIR_BAR(0) + (unit01 ? 8 : 0);
     io = bus_alloc_resource_any(parent, SYS_RES_IOPORT, &rid, RF_ACTIVE);
     if (!io)
 	return ENXIO;
@@ -157,7 +157,7 @@
     rid = PCIR_BAR(1) + (unit01 ? 8 : 0);
     ctlio = bus_alloc_resource_any(parent, SYS_RES_IOPORT, &rid, RF_ACTIVE);
     if (!ctlio) {
-	bus_release_resource(dev, SYS_RES_IOPORT, ATA_IOADDR_RID, io);
+	bus_release_resource(parent, SYS_RES_IOPORT, io_rid, io);
 	return ENXIO;
     }