1
0
Fork 0

mtd: zero out mtd_partition struct before using it

It's easier to guarantee we've cleared out all unused fields with
memset() than by manually initializing each field.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Reviewed-by: Boris Brezillon <boris.brezillon@free-electrons.com>
hifive-unleashed-5.1
Brian Norris 2015-11-11 16:47:52 -08:00
parent 215a02fd30
commit 9386723389
1 changed files with 1 additions and 2 deletions

View File

@ -596,11 +596,10 @@ int mtd_add_partition(struct mtd_info *master, const char *name,
if (length <= 0)
return -EINVAL;
memset(&part, 0, sizeof(part));
part.name = name;
part.size = length;
part.offset = offset;
part.mask_flags = 0;
part.ecclayout = NULL;
new = allocate_partition(master, &part, -1, offset);
if (IS_ERR(new))