summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorian <ian@FreeBSD.org>2014-03-14 00:49:02 +0000
committerian <ian@FreeBSD.org>2014-03-14 00:49:02 +0000
commit7db44467a1848280bf8cfa310255659f8d62b371 (patch)
treedcda3696e310b2f8aedd78cf3bf86d0cadfea28d
parent0d3fbce5f2331d94d273480e7d61ca764e204a63 (diff)
downloadFreeBSD-src-7db44467a1848280bf8cfa310255659f8d62b371.zip
FreeBSD-src-7db44467a1848280bf8cfa310255659f8d62b371.tar.gz
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.
-rw-r--r--sys/boot/uboot/common/main.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/sys/boot/uboot/common/main.c b/sys/boot/uboot/common/main.c
index 531d728..20d3850 100644
--- a/sys/boot/uboot/common/main.c
+++ b/sys/boot/uboot/common/main.c
@@ -298,9 +298,10 @@ get_load_device(int *type, int *unit, int *slice, int *partition)
}
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, int load_slice, int load_partition)
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, int load_slice, int load_partition)
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, int load_slice, int load_partition)
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;
}
OpenPOWER on IntegriCloud