]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
dm: cbfs: Fix handling of invalid type
authorSimon Glass <sjg@chromium.org>
Mon, 29 Feb 2016 22:25:49 +0000 (15:25 -0700)
committerSimon Glass <sjg@chromium.org>
Mon, 14 Mar 2016 21:34:50 +0000 (15:34 -0600)
The comment for file_cbfs_type() says that it returns 0 for an invalid type.
The code appears to check for -1, except that it uses an unsigned variable
to store the type. This results in a warning on 64-bit machines.

Adjust it to make the meaning clearer. Continue to handle the -1 case since
it may be needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
Tested-by: Stephen Warren <swarren@nvidia.com>
cmd/cbfs.c

index 35d8a7a89bfbea6a12a11d4269528d53133b6aee..779e9c043bdcc585cc04469e2cce952d29513edf 100644 (file)
@@ -103,7 +103,7 @@ int do_cbfs_ls(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
        printf("     size              type  name\n");
        printf("------------------------------------------\n");
        while (file) {
-               u32 type = file_cbfs_type(file);
+               int type = file_cbfs_type(file);
                char *type_name = NULL;
                const char *filename = file_cbfs_name(file);
 
@@ -140,7 +140,8 @@ int do_cbfs_ls(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
                case CBFS_COMPONENT_CMOS_LAYOUT:
                        type_name = "cmos layout";
                        break;
-               case -1UL:
+               case -1:
+               case 0:
                        type_name = "null";
                        break;
                }