diff options
-rw-r--r-- | futility/cmd_read.c | 7 | ||||
-rw-r--r-- | futility/updater_utils.c | 8 | ||||
-rw-r--r-- | futility/updater_utils.h | 3 |
3 files changed, 12 insertions, 6 deletions
diff --git a/futility/cmd_read.c b/futility/cmd_read.c index e0c83616..e99264ae 100644 --- a/futility/cmd_read.c +++ b/futility/cmd_read.c @@ -104,7 +104,12 @@ static int do_read(int argc, char *argv[]) errorcnt += updater_setup_config(cfg, &args, &update_needed); if (!errorcnt && update_needed) { prepare_servo_control(prepare_ctrl_name, 1); - if (load_system_firmware(cfg, &cfg->image_current)) + int r = load_system_firmware(cfg, &cfg->image_current); + /* + * Ignore a parse error as we still want to write the file + * out in that case + */ + if (r && r != IMAGE_PARSE_FAILURE) errorcnt++; prepare_servo_control(prepare_ctrl_name, 0); } diff --git a/futility/updater_utils.c b/futility/updater_utils.c index 883b7027..8895c094 100644 --- a/futility/updater_utils.c +++ b/futility/updater_utils.c @@ -159,6 +159,10 @@ static int load_firmware_version(struct firmware_image *image, return 0; } +/* + * Fills in the other fields of image using image->data. + * Returns IMAGE_LOAD_SUCCESS or IMAGE_PARSE_FAILURE. + */ static int parse_firmware_image(struct firmware_image *image) { int ret = IMAGE_LOAD_SUCCESS; @@ -685,10 +689,6 @@ static int write_flash(struct flashrom_params *params, return r; } -/* - * Loads the active system firmware image (usually from SPI flash chip). - * Returns 0 if success, non-zero if error. - */ int load_system_firmware(struct updater_config *cfg, struct firmware_image *image) { diff --git a/futility/updater_utils.h b/futility/updater_utils.h index 953b91f0..a0dfc912 100644 --- a/futility/updater_utils.h +++ b/futility/updater_utils.h @@ -96,7 +96,8 @@ struct updater_config; /* * Loads the active system firmware image (usually from SPI flash chip). - * Returns 0 if success, non-zero if error. + * Returns 0 if success. Returns IMAGE_PARSE_FAILURE for non-vboot images. + * Returns other values for error. */ int load_system_firmware(struct updater_config *cfg, struct firmware_image *image); |