Commit 2f02a7ec authored by Fuqian Huang's avatar Fuqian Huang Committed by Rafael J. Wysocki

kernel: power: swap: use kzalloc() instead of kmalloc() followed by memset()

Use zeroing allocator instead of using allocator
followed with memset with 0
Signed-off-by: default avatarFuqian Huang <huangfq.daxian@gmail.com>
Acked-by: default avatarPavel Machek <pavel@ucw.cz>
[ rjw: Subject ]
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent e9bea8f9
...@@ -974,12 +974,11 @@ static int get_swap_reader(struct swap_map_handle *handle, ...@@ -974,12 +974,11 @@ static int get_swap_reader(struct swap_map_handle *handle,
last = handle->maps = NULL; last = handle->maps = NULL;
offset = swsusp_header->image; offset = swsusp_header->image;
while (offset) { while (offset) {
tmp = kmalloc(sizeof(*handle->maps), GFP_KERNEL); tmp = kzalloc(sizeof(*handle->maps), GFP_KERNEL);
if (!tmp) { if (!tmp) {
release_swap_reader(handle); release_swap_reader(handle);
return -ENOMEM; return -ENOMEM;
} }
memset(tmp, 0, sizeof(*tmp));
if (!handle->maps) if (!handle->maps)
handle->maps = tmp; handle->maps = tmp;
if (last) if (last)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment