mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-03 15:55:38 +00:00
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>
This commit is contained in:
parent
215a02fd30
commit
9386723389
1 changed files with 1 additions and 2 deletions
|
@ -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))
|
||||
|
|
Loading…
Add table
Reference in a new issue