summaryrefslogtreecommitdiff
path: root/lib/vbexport
diff options
context:
space:
mode:
authorChe-Liang Chiou <clchiou@chromium.org>2011-07-20 18:42:29 +0800
committerSimon Glass <sjg@chromium.org>2011-08-29 10:59:03 -0700
commitbce870b71d2af4ee8a7989db7b0fe2b5e4cdd550 (patch)
tree2c6873576c0e9ac4e61adceceec1329eac8b8fb5 /lib/vbexport
parent7382683d723ce5106d92102c522ed4251551cec4 (diff)
CHROMIUM: fix error of showing eMMC as a removable disk
It is too bad that I did not catch this when I tested the cleanup patch. To avoid that from happening again, more checks are added to "vbexport_test diskinfo" that prints out an error message when the flag of any probed storage device mismatches the given flag. BUG=chromium-os:16542 TEST=manual When no SD card and USB key is inserted, vbexport_test diskinfo prints "No disk found!" under "Detecting all removable disks..." test. Change-Id: I0e20a6337c7cd638b883cf36416fdb3ae5bd3071 Reviewed-on: http://gerrit.chromium.org/gerrit/4392 Tested-by: Che-Liang Chiou <clchiou@chromium.org> Reviewed-by: Tammo Spalink <tammo@chromium.org>
Diffstat (limited to 'lib/vbexport')
-rw-r--r--lib/vbexport/boot_device.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/vbexport/boot_device.c b/lib/vbexport/boot_device.c
index b6aa95b449..059c521c0f 100644
--- a/lib/vbexport/boot_device.c
+++ b/lib/vbexport/boot_device.c
@@ -119,19 +119,20 @@ VbError_t VbExDiskGetInfo(VbDiskInfo** infos_ptr, uint32_t* count_ptr,
if (!(disk_flags & VB_DISK_FLAG_REMOVABLE))
iterators[1] = NULL;
+ /*
+ * If too many storage devices registered, we return as many disk infos
+ * as possible.
+ */
for (func_index = 0;
count < max_count && (iter = iterators[func_index]);
func_index++) {
if (iter == iterate_usb_device)
init_usb_storage();
- /*
- * If too many storage devices registered, we return as many
- * disk infos as possible.
- */
- for (i = 0; count < max_count && (dev = iter(&i)); count++) {
- flags = get_dev_flags(dev);
+ i = 0;
+ while (count < max_count && (dev = iter(&i))) {
/* Skip this entry if the flags are not matched. */
+ flags = get_dev_flags(dev);
if (!(flags & disk_flags))
continue;
@@ -140,6 +141,7 @@ VbError_t VbExDiskGetInfo(VbDiskInfo** infos_ptr, uint32_t* count_ptr,
infos[count].lba_count = dev->lba;
infos[count].flags = flags;
infos[count].name = get_dev_name(dev);
+ count++;
}
}