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>
This commit is contained in:
Vadim Bendebury
2016-12-19 11:22:30 -08:00
committed by chrome-bot
parent 47b7390858
commit e5805287d0

View File

@@ -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) {