--- drivers/md/raid5.c.orig	Tue May  8 19:17:22 2001
+++ drivers/md/raid5.c	Tue May  8 19:20:07 2001
@@ -157,17 +157,21 @@
 		memset(bh, 0, sizeof (struct buffer_head));
 		init_waitqueue_head(&bh->b_wait);
 		page = alloc_page(priority);
+		if (!page)
+			goto nomem_path;
 		bh->b_data = page_address(page);
-		if (!bh->b_data) {
-			kfree(bh);
-			return 1;
-		}
+		if (!bh->b_data)
+			goto nomem_path;
 		atomic_set(&bh->b_count, 0);
 		bh->b_page = page;
 		sh->bh_cache[i] = bh;
 
 	}
 	return 0;
+
+nomem_path:
+	kfree(bh);
+	return 1;
 }
 
 static struct buffer_head *raid5_build_block (struct stripe_head *sh, int i);
