mmc-utils: Fix ffu in case of unsupported MODE_OPERATION_CODES

Move up the return in case MODE_OPERATION_CODES is not supported.
According to the specification when MODE_OPERATION_CODES is not
supported no checks should be done against NUM_OF_FW_SEC_PROG.

Signed-off-by: Bruno Matic <bruno.matic@nokia.com>
Fixes: 89cd01ed86 (mmc_utils: add ffu support)
Reviewed-by: Avri Altman <avri.altman@wdc.com>
Link: https://lore.kernel.org/r/20220920124749.24073-1-bruno.matic@nokia.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
This commit is contained in:
Bruno Matic 2022-09-20 14:47:49 +02:00 committed by Ulf Hansson
parent 5086e7c0de
commit 2a934139cf

View File

@ -2899,6 +2899,16 @@ do_retry:
goto out;
}
/*
* By spec - check if mode operation codes are supported in ffu features,
* if not then skip checking number of sectors programmed after install
*/
if (!ext_csd[EXT_CSD_FFU_FEATURES]) {
fprintf(stderr, "Please reboot to complete firmware installation on %s\n", device);
ret = 0;
goto out;
}
ret = read_extcsd(dev_fd, ext_csd);
if (ret) {
fprintf(stderr, "Could not read EXT_CSD from %s\n", device);
@ -2929,10 +2939,6 @@ do_retry:
goto out;
}
/* check mode operation for ffu install*/
if (!ext_csd[EXT_CSD_FFU_FEATURES]) {
fprintf(stderr, "Please reboot to complete firmware installation on %s\n", device);
} else {
fprintf(stderr, "Installing firmware on %s...\n", device);
/* Re-enter ffu mode and install the firmware */
multi_cmd->num_of_cmds = 2;
@ -2972,7 +2978,6 @@ do_retry:
} else {
fprintf(stderr, "FFU finished successfully\n");
}
}
out:
free(buf);