Tidy pgpath in choosing funcs.
--- diff/drivers/md/dm-mpath.c	2005-01-12 19:14:55.000000000 +0000
+++ source/drivers/md/dm-mpath.c	2005-01-12 19:16:42.000000000 +0000
@@ -212,48 +212,42 @@
 	}
 }
 
-static struct pgpath *__choose_path_in_pg(struct multipath *m,
-					  struct priority_group *pg)
+/*
+ * Returns 0 if it set a new path
+ */
+static int __choose_path_in_pg(struct multipath *m, struct priority_group *pg)
 {
 	struct path *path;
-	struct pgpath *pgpath;
 
 	path = pg->ps.type->select_path(&pg->ps, &m->current_count);
-	if (!path) {
-		return NULL;
-	}
+	if (!path)
+		return -ENXIO;
 
-	pgpath = path_to_pgpath(path);
+	m->current_pgpath = path_to_pgpath(path);
 
 	if (m->current_pg != pg)
-		__switch_pg(m, pgpath);
+		__switch_pg(m, m->current_pgpath);
 
-	return pgpath;
+	return 0;
 }
 
 static void __choose_pgpath(struct multipath *m)
 {
 	struct priority_group *pg;
-	struct pgpath *pgpath = NULL;
 	unsigned bypassed = 1;
 
 	if (!m->nr_valid_paths)
-		goto out;
+		goto failed;
 
 	/* Were we instructed to switch PG? */
-	if (m->next_pg) {
-		pgpath = __choose_path_in_pg(m, m->next_pg);
+	if (m->next_pg && !__choose_path_in_pg(m, m->next_pg)) {
 		m->next_pg = NULL;
-		if (pgpath)
-			goto out;
+		return;
 	}
 
 	/* Don't change PG until it has no remaining paths */
-	if (m->current_pg) {
-		pgpath = __choose_path_in_pg(m, m->current_pg);
-		if (pgpath)
-			goto out;
-	}
+	if (m->current_pg && !__choose_path_in_pg(m, m->current_pg))
+		return;
 
 	/*
 	 * Loop through priority groups until we find a valid path.
@@ -264,14 +258,14 @@
 		list_for_each_entry (pg, &m->priority_groups, list) {
 			if (pg->bypassed == bypassed)
 				continue;
-			pgpath = __choose_path_in_pg(m, pg);
-			if (pgpath)
-				goto out;
+			if (!__choose_path_in_pg(m, pg))
+				return;
 		}
 	} while (bypassed--);
 
-out:
-	m->current_pgpath = pgpath;
+failed:
+	m->current_pgpath = NULL;
+	m->current_pg = NULL;
 }
 
 static int map_io(struct multipath *m, struct bio *bio, struct mpath_io *mpio,
