summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVadim Bendebury <vbendeb@chromium.org>2016-12-19 11:22:30 -0800
committerchrome-bot <chrome-bot@chromium.org>2016-12-20 18:05:09 -0800
commite5805287d01edd8f81641b126defc5b3ad366d2c (patch)
treed0ef26999466a50d4a2e0938b561963b1be1f5de
parent47b7390858287ff18d246c097a79c4f2350668c2 (diff)
downloadchrome-ec-e5805287d01edd8f81641b126defc5b3ad366d2c.tar.gz
usb_updater: initialize corrupt_inactive_rw before using it
The earlier change introduced the uninitialized variable bug, which was not caught by the compiler. Let's make sure the variable is always initialized, and also let's add a message informing the user that the binary image is ignored when -f or -c command line options are given. BRANCH=none BUG=chrome-os-partner:55667 TEST=there is no accidental attempts to erase the inactive firmware any more. The message is printed when the binary image is ignored. Change-Id: If67841fa3933e7c2df772348ed5308ff722a6e3a Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/421498 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
-rw-r--r--extra/usb_updater/usb_updater.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/extra/usb_updater/usb_updater.c b/extra/usb_updater/usb_updater.c
index 04e5b615f0..e41c3027b1 100644
--- a/extra/usb_updater/usb_updater.c
+++ b/extra/usb_updater/usb_updater.c
@@ -1198,7 +1198,7 @@ int main(int argc, char *argv[])
int transferred_sections = 0;
int binary_vers = 0;
int show_fw_ver = 0;
- int corrupt_inactive_rw;
+ int corrupt_inactive_rw = 0;
progname = strrchr(argv[0], '/');
if (progname)
@@ -1281,6 +1281,9 @@ int main(int argc, char *argv[])
if (binary_vers)
exit(show_headers_versions(data));
+ } else {
+ if (optind < argc)
+ printf("Ignoring binary image %s\n", argv[optind]);
}
if (td.ep_type == usb_xfer) {