]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
FAT: initialize all fields in cur_part_info, simplify init
authorStephen Warren <swarren@nvidia.com>
Wed, 17 Oct 2012 06:44:58 +0000 (06:44 +0000)
committerTom Rini <trini@ti.com>
Thu, 25 Oct 2012 19:07:45 +0000 (12:07 -0700)
cur_part_info.{name,type} are strings. So, we don't need to memset()
the entire thing, just put the NULL-termination in the first byte.

Add missing initialization of the bootable and uuid fields.

None of these fields are actually used by fat.c. However, since it
stores the entire disk_partition_t, we should make sure that all fields
are valid.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Reviewed-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com>
fs/fat/fat.c

index 731d3690c318d523aa216a4b0e4785e062886730..31042e535787e059536bf16522799c7307096774 100644 (file)
@@ -92,8 +92,12 @@ int fat_register_device(block_dev_desc_t * dev_desc, int part_no)
                cur_part_info.start = 0;
                cur_part_info.size = dev_desc->lba;
                cur_part_info.blksz = dev_desc->blksz;
-               memset(cur_part_info.name, 0, sizeof(cur_part_info.name));
-               memset(cur_part_info.type, 0, sizeof(cur_part_info.type));
+               cur_part_info.name[0] = 0;
+               cur_part_info.type[0] = 0;
+               cur_part_info.bootable = 0;
+#ifdef CONFIG_PARTITION_UUIDS
+               cur_part_info.uuid[0] = 0;
+#endif
        }
 
        /* Make sure it has a valid FAT header */