From patchwork Wed Oct 10 18:14:01 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [U-Boot, V3, 3/4] FAT: initialize all fields in cur_part_info, simplify init Date: Wed, 10 Oct 2012 08:14:01 -0000 From: Stephen Warren X-Patchwork-Id: 190804 Message-Id: <1349892842-11994-3-git-send-email-swarren@wwwdotorg.org> To: Tom Rini Cc: u-boot@lists.denx.de, Stephen Warren , Rob Herring From: Stephen Warren 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 --- v3: New patch. --- fs/fat/fat.c | 8 ++++++-- 1 files changed, 6 insertions(+), 2 deletions(-) diff --git a/fs/fat/fat.c b/fs/fat/fat.c index 1e0d2a3..2863c4b 100644 --- a/fs/fat/fat.c +++ b/fs/fat/fat.c @@ -94,8 +94,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 */