patch-2.3.17 linux/drivers/i2o/i2o_pci.c

Next file: linux/drivers/i2o/i2o_scsi.c
Previous file: linux/drivers/i2o/i2o_core.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.16/linux/drivers/i2o/i2o_pci.c linux/drivers/i2o/i2o_pci.c
@@ -105,7 +105,7 @@
 		/* Skip I/O spaces */
 		if(!(dev->resource[i].flags&PCI_BASE_ADDRESS_SPACE))
 		{
-			memptr=dev->resource[i].flags;
+			memptr=dev->resource[i].start;
 			break;
 		}
 	}
@@ -113,14 +113,21 @@
 	if(i==6)
 	{
 		printk(KERN_ERR "i2o_pci: I2O controller has no memory regions defined.\n");
-		return -ENOMEM;
+		kfree(c);
+		return -EINVAL;
 	}
 	
 	size = dev->resource[i].end-dev->resource[i].start+1;	
 	/* Map the I2O controller */
 	
-	printk(KERN_INFO "PCI I2O controller at 0x%08X size=%d\n", memptr, -size);
-	mem = ioremap(memptr, -size);
+	printk(KERN_INFO "PCI I2O controller at 0x%08X size=%d\n", memptr, size);
+	mem = ioremap(memptr, size);
+	if(mem==NULL)
+	{
+		printk(KERN_ERR "i2o_pci: Unable to map controller.\n");
+		kfree(c);
+		return -EINVAL;
+	}
 	
 	c->bus.pci.irq = -1;
 
@@ -148,6 +155,8 @@
 	if(i<0)
 	{
 		printk(KERN_ERR "i2o: unable to install controller.\n");
+		kfree(c);
+		iounmap(mem);
 		return i;
 	}
 
@@ -165,7 +174,9 @@
 			core->delete(c);
 #else
 			i2o_delete_controller(c);
-#endif /* MODULE */
+#endif /* MODULE */	
+			kfree(c);
+			iounmap(mem);
 			return -EBUSY;
 		}
 	}
@@ -190,8 +201,7 @@
 		}
 		printk(KERN_INFO "I2O controller on bus %d at %d.\n",
 			dev->bus->number, dev->devfn);
-		if(!dev->master)
-			printk(KERN_WARNING "Controller not master enabled.\n");
+		pci_set_master(dev);
 		if(i2o_pci_install(dev)==0)
 			count++;
 	}
@@ -247,6 +257,7 @@
 
 		if(c==NULL)
 			continue;		
+			
 		if(c->type == I2O_TYPE_PCI)
 		{
 #ifdef MODULE
@@ -265,7 +276,6 @@
 #endif
 				continue;
 			}
-		
 			I2O_IRQ_WRITE32(c,0);
 		}
 #ifdef MODULE

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)