patch-2.4.4 linux/drivers/pcmcia/pci_socket.c

Next file: linux/drivers/pcmcia/yenta.c
Previous file: linux/drivers/pcmcia/hd64465_ss.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.3/linux/drivers/pcmcia/pci_socket.c linux/drivers/pcmcia/pci_socket.c
@@ -172,13 +172,20 @@
 static int __devinit add_pci_socket(int nr, struct pci_dev *dev, struct pci_socket_ops *ops)
 {
 	pci_socket_t *socket = nr + pci_socket_array;
-
+	int err;
+	
 	memset(socket, 0, sizeof(*socket));
 	socket->dev = dev;
 	socket->op = ops;
 	dev->driver_data = socket;
 	spin_lock_init(&socket->event_lock);
-	return socket->op->open(socket);
+	err = socket->op->open(socket);
+	if(err)
+	{
+		socket->dev = NULL;
+		dev->driver_data = NULL;
+	}
+	return err;
 }
 
 void cardbus_register(pci_socket_t *socket)
@@ -195,8 +202,7 @@
 
 	for (s = 0; s < MAX_SOCKETS; s++) {
 		if (pci_socket_array [s].dev == 0) {
-			add_pci_socket (s, dev, &yenta_operations);
-			return 0;
+			return add_pci_socket (s, dev, &yenta_operations);
 		}
 	}
 	return -ENODEV;

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