summaryrefslogtreecommitdiffstats
path: root/kernel/power
diff options
context:
space:
mode:
authorFuqian Huang <huangfq.daxian@gmail.com>2019-06-28 10:50:35 +0800
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2019-06-28 10:20:39 +0200
commit2f02a7ecd512288c40bd72bdd4d87ab4f01c1615 (patch)
treeb52dd965b6da75badb3f3d0a39a531b1fc85f973 /kernel/power
parente9bea8f98a539080070e3eff70a1731ce0ffdc8d (diff)
downloadlinux-2f02a7ecd512288c40bd72bdd4d87ab4f01c1615.tar.bz2
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: Fuqian Huang <huangfq.daxian@gmail.com> Acked-by: Pavel Machek <pavel@ucw.cz> [ rjw: Subject ] Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'kernel/power')
-rw-r--r--kernel/power/swap.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/kernel/power/swap.c b/kernel/power/swap.c
index e1912ad13bdc..ca0fcb5ced71 100644
--- a/kernel/power/swap.c
+++ b/kernel/power/swap.c
@@ -974,12 +974,11 @@ static int get_swap_reader(struct swap_map_handle *handle,
last = handle->maps = NULL;
offset = swsusp_header->image;
while (offset) {
- tmp = kmalloc(sizeof(*handle->maps), GFP_KERNEL);
+ tmp = kzalloc(sizeof(*handle->maps), GFP_KERNEL);
if (!tmp) {
release_swap_reader(handle);
return -ENOMEM;
}
- memset(tmp, 0, sizeof(*tmp));
if (!handle->maps)
handle->maps = tmp;
if (last)