Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 14 Mar 2014 00:49:02 +0000 (UTC)
From:      Ian Lepore <ian@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r263124 - head/sys/boot/uboot/common
Message-ID:  <201403140049.s2E0n2Zp081319@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ian
Date: Fri Mar 14 00:49:02 2014
New Revision: 263124
URL: http://svnweb.freebsd.org/changeset/base/263124

Log:
  Fix an uninitialized variable error I perpetrated when splitting some
  code into a separate function.  Pass the missing value from main() to
  the probe_disks() function.

Modified:
  head/sys/boot/uboot/common/main.c

Modified: head/sys/boot/uboot/common/main.c
==============================================================================
--- head/sys/boot/uboot/common/main.c	Fri Mar 14 00:47:46 2014	(r263123)
+++ head/sys/boot/uboot/common/main.c	Fri Mar 14 00:49:02 2014	(r263124)
@@ -298,9 +298,10 @@ get_load_device(int *type, int *unit, in
 } 
 
 static int
-probe_disks(int load_type, int load_unit, int load_slice, int load_partition)
+probe_disks(int devidx, int load_type, int load_unit, int load_slice, 
+    int load_partition)
 {
-	int i, open_result, unit;
+	int open_result, unit;
 	struct open_file f;
 
 	currdev.d_disk.slice = load_slice;
@@ -317,7 +318,7 @@ probe_disks(int load_type, int load_unit
 			printf("Checking unit=%d slice=%d partition=%d...",
 			    currdev.d_unit, currdev.d_disk.slice, 
 			    currdev.d_disk.partition);
-			open_result = devsw[i]->dv_open(&f, &currdev);
+			open_result = devsw[devidx]->dv_open(&f, &currdev);
 			if (open_result == 0) {
 				printf(" good.\n");
 				return (0);
@@ -337,7 +338,7 @@ probe_disks(int load_type, int load_unit
 			printf("Checking unit=%d slice=%d partition=%d...",
 			    currdev.d_unit, currdev.d_disk.slice, 
 			    currdev.d_disk.partition);
-			open_result = devsw[i]->dv_open(&f, &currdev);
+			open_result = devsw[devidx]->dv_open(&f, &currdev);
 			if (open_result == 0) {
 				printf(" good.\n");
 				return (0);
@@ -351,7 +352,7 @@ probe_disks(int load_type, int load_unit
 		printf("Checking unit=%d slice=%d partition=%d...",
 		    currdev.d_unit, currdev.d_disk.slice,
 		    currdev.d_disk.partition);
-		open_result = devsw[i]->dv_open(&f,&currdev);
+		open_result = devsw[devidx]->dv_open(&f,&currdev);
 		if (open_result == 0) {
 			printf("good.\n");
 			return (0);
@@ -440,7 +441,7 @@ main(void)
 
 		if ((load_type == -1 || (load_type & DEV_TYP_STOR)) &&
 		    strcmp(devsw[i]->dv_name, "disk") == 0) {
-			if (probe_disks(load_type, load_unit, load_slice, 
+			if (probe_disks(i, load_type, load_unit, load_slice, 
 			    load_partition) == 0)
 				break;
 		}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201403140049.s2E0n2Zp081319>