summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFurquan Shaikh <furquan@google.com>2015-05-09 01:48:12 (GMT)
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-05-11 20:45:38 (GMT)
commitf9b76e16dbe02808164a4855245f84a12bc014b8 (patch)
treec1b33be2171d682d3ef11b470bc29c41a9d27e4a
parentbe6706c39ed0babbc27973351e9eb5ce2068373e (diff)
downloaddepthcharge-stabilize-7059.B.tar.gz
depthcharge-stabilize-7059.B.tar.xz
fit: Select default config if there is no compat match.stabilize-7060.Bstabilize-7059.B
FIT config selection is expected to work in the following way: 1. Check if there is a config with compat string match. 2. If there is no compat string match, then the default config should be selected. However, the config selection logic in depthcharge currently selects the first config even if compat string does not match. This prevents the default config from being selected in cases where there is no config with matching compat string. This patch fixes the issue by checking if compat_rank for a config is not -1 when there is no compat_config selected and only then updates the compat_config. BUG=chrome-os-partner:40007 BRANCH=None TEST=Compiles successfully and selects default config in case of no compat match. Change-Id: I239224c760f96ee94bab771ee2e812eaf28ddabe Signed-off-by: Furquan Shaikh <furquan@google.com> Reviewed-on: https://chromium-review.googlesource.com/270175 Trybot-Ready: Furquan Shaikh <furquan@chromium.org> Tested-by: Furquan Shaikh <furquan@chromium.org> Reviewed-by: Gwendal Grignou <gwendal@chromium.org> Commit-Queue: Furquan Shaikh <furquan@chromium.org>
-rw-r--r--src/boot/fit.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/boot/fit.c b/src/boot/fit.c
index 722067a..254adbf 100644
--- a/src/boot/fit.c
+++ b/src/boot/fit.c
@@ -428,10 +428,11 @@ int fit_load(void *fit, char *cmd_line, void **kernel, uint32_t *kernel_size,
compat_str += len;
bytes -= len;
}
- if (!compat_config ||
- config->compat_rank > compat_config->compat_rank) {
+
+ if ((compat_config && (config->compat_rank >
+ compat_config->compat_rank)) ||
+ (!compat_config && (config->compat_rank != -1)))
compat_config = config;
- }
}
printf("\n");
}