]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
image: Fix loop condition to avoid warning
authorThierry Reding <treding@nvidia.com>
Thu, 20 Aug 2015 09:45:43 +0000 (11:45 +0200)
committerTom Rini <trini@konsulko.com>
Fri, 28 Aug 2015 15:46:35 +0000 (11:46 -0400)
GCC 5.1 starts warning for comparisons such as !a > 0, assuming that the
negation was meant to apply to the whole expression rather than just the
left operand.

Indeed the comparison in the FIT loadable code is confusingly written,
though it does end up doing the right thing. Rewrite the condition to be
more explicit, that is, iterate over strings until they're exhausted.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
common/image.c

index ca721c5401c29df4907576e3765b7c647afa0c5c..678588d2e330f3b151a89e1cdb0cb338fffe4c20 100644 (file)
@@ -1215,10 +1215,10 @@ int boot_get_loadable(int argc, char * const argv[], bootm_headers_t *images,
                conf_noffset = fit_conf_get_node(buf, images->fit_uname_cfg);
 
                for (loadables_index = 0;
-                    !fdt_get_string_index(buf, conf_noffset,
+                    fdt_get_string_index(buf, conf_noffset,
                                FIT_LOADABLE_PROP,
                                loadables_index,
-                               (const char **)&uname) > 0;
+                               (const char **)&uname) == 0;
                     loadables_index++)
                {
                        fit_img_result = fit_image_load(images,