patch-2.4.9 linux/drivers/pcmcia/bulkmem.c

Next file: linux/drivers/s390/net/iucv.c
Previous file: linux/drivers/pci/pci.ids
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.8/linux/drivers/pcmcia/bulkmem.c linux/drivers/pcmcia/bulkmem.c
@@ -211,7 +211,7 @@
     retry_erase((erase_busy_t *)arg, MTD_REQ_TIMEOUT);
 }
 
-static void setup_erase_request(client_handle_t handle, eraseq_entry_t *erase)
+static int setup_erase_request(client_handle_t handle, eraseq_entry_t *erase)
 {
     erase_busy_t *busy;
     region_info_t *info;
@@ -229,6 +229,8 @@
 	else {
 	    erase->State = 1;
 	    busy = kmalloc(sizeof(erase_busy_t), GFP_KERNEL);
+	    if (!busy)
+		return CS_GENERAL_FAILURE;
 	    busy->erase = erase;
 	    busy->client = handle;
 	    init_timer(&busy->timeout);
@@ -238,6 +240,7 @@
 	    retry_erase(busy, 0);
 	}
     }
+    return CS_SUCCESS;
 } /* setup_erase_request */
 
 /*======================================================================
@@ -322,7 +325,7 @@
     
 ======================================================================*/
 
-static void setup_regions(client_handle_t handle, int attr,
+static int setup_regions(client_handle_t handle, int attr,
 			  memory_handle_t *list)
 {
     int i, code, has_jedec, has_geo;
@@ -337,7 +340,7 @@
 
     code = (attr) ? CISTPL_DEVICE_A : CISTPL_DEVICE;
     if (read_tuple(handle, code, &device) != CS_SUCCESS)
-	return;
+	return CS_GENERAL_FAILURE;
     code = (attr) ? CISTPL_JEDEC_A : CISTPL_JEDEC_C;
     has_jedec = (read_tuple(handle, code, &jedec) == CS_SUCCESS);
     if (has_jedec && (device.ndev != jedec.nid)) {
@@ -360,6 +363,8 @@
 	if ((device.dev[i].type != CISTPL_DTYPE_NULL) &&
 	    (device.dev[i].size != 0)) {
 	    r = kmalloc(sizeof(*r), GFP_KERNEL);
+	    if (!r)
+		return CS_GENERAL_FAILURE;
 	    r->region_magic = REGION_MAGIC;
 	    r->state = 0;
 	    r->dev_info[0] = '\0';
@@ -384,6 +389,7 @@
 	}
 	offset += device.dev[i].size;
     }
+    return CS_SUCCESS;
 } /* setup_regions */
 
 /*======================================================================
@@ -417,8 +423,10 @@
     
     if ((handle->Attributes & INFO_MASTER_CLIENT) &&
 	(!(s->state & SOCKET_REGION_INFO))) {
-	setup_regions(handle, 0, &s->c_region);
-	setup_regions(handle, 1, &s->a_region);
+	if (setup_regions(handle, 0, &s->c_region) != CS_SUCCESS)
+	    return CS_GENERAL_FAILURE;
+	if (setup_regions(handle, 1, &s->a_region) != CS_SUCCESS)
+	    return CS_GENERAL_FAILURE;
 	s->state |= SOCKET_REGION_INFO;
     }
 

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