[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1609978.ayZxNtafmO@kreacher>
Date: Fri, 28 Jun 2019 12:16:36 +0200
From: "Rafael J. Wysocki" <rjw@...ysocki.net>
To: Fuqian Huang <huangfq.daxian@...il.com>
Cc: Len Brown <len.brown@...el.com>, Pavel Machek <pavel@....cz>,
linux-pm@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 25/27] kernel: power: use kzalloc rather than kmalloc followed with memset
On Friday, June 28, 2019 4:50:35 AM CEST Fuqian Huang wrote:
> Use zeroing allocator instead of using allocator
> followed with memset with 0
>
> Signed-off-by: Fuqian Huang <huangfq.daxian@...il.com>
> ---
> kernel/power/swap.c | 3 +--
> 1 file changed, 1 insertion(+), 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)
>
Queued up for 5.3 with minor subject changes. Thanks!
Powered by blists - more mailing lists