From: Adrian Bunk <[email-masked]>

This patch fixes two NULL dereferences introduced by
commit 06386bbfd2441416875d0403d405c56822f6ebac and spotted by the 
Coverity checker.

Signed-off-by: Adrian Bunk <[email-masked]>
Signed-off-by: Alasdair G Kergon <[email-masked]>

---
 drivers/md/dm-raid1.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

Index: linux-2.6.25-rc1/drivers/md/dm-raid1.c
===================================================================
--- linux-2.6.25-rc1.orig/drivers/md/dm-raid1.c	2008-02-19 19:38:59.000000000 +0000
+++ linux-2.6.25-rc1/drivers/md/dm-raid1.c	2008-02-19 19:39:54.000000000 +0000
@@ -1695,14 +1695,15 @@ static int mirror_end_io(struct dm_targe
 			 * information for a retry or there was no other
 			 * mirror in-sync.
 			 */
-			DMERR_LIMIT("Mirror read failed from %s.",
-				    m->dev->name);
+			DMERR_LIMIT("Mirror read failed.");
 			return -EIO;
 		}
+
+		m = read_record->m;
+
 		DMERR("Mirror read failed from %s. Trying alternative device.",
 		      m->dev->name);
 
-		m = read_record->m;
 		fail_mirror(m, DM_RAID1_READ_ERROR);
 
 		/*