--- ../linux/drivers/ide/ide-probe.c	Sun Mar 18 09:25:02 2001
+++ ide-probe.c	Sat May 12 16:42:34 2001
@@ -745,7 +745,7 @@
  * structures needed for the routines in genhd.c.  ide_geninit() gets called
  * somewhat later, during the partition check.
  */
-static void init_gendisk (ide_hwif_t *hwif)
+static int init_gendisk (ide_hwif_t *hwif)
 {
 	struct gendisk *gd, **gdp;
 	unsigned int unit, units, minors;
@@ -759,6 +759,10 @@
 	}
 	minors    = units * (1<<PARTN_BITS);
 	gd        = kmalloc (sizeof(struct gendisk), GFP_KERNEL);
+
+	if(!gd)
+		return 0;
+
 	gd->sizes = kmalloc (minors * sizeof(int), GFP_KERNEL);
 	gd->part  = kmalloc (minors * sizeof(struct hd_struct), GFP_KERNEL);
 	bs        = kmalloc (minors*sizeof(int), GFP_KERNEL);
@@ -863,8 +867,10 @@
 		printk("%s: probed IRQ %d failed, using default.\n",
 			hwif->name, hwif->irq);
 	}
-	
-	init_gendisk(hwif);
+
+	if(!init_gendisk(hwif))
+		return 0;       /* failed to initialize*/
+
 	blk_dev[hwif->major].data = hwif;
 	blk_dev[hwif->major].queue = ide_get_queue;
 	read_ahead[hwif->major] = 8;	/* (4kB) */
