linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 43/87] kernel: power: replace kmalloc and memset with kzalloc
@ 2019-06-27 17:40 Fuqian Huang
  2019-06-27 19:56 ` Pavel Machek
  0 siblings, 1 reply; 2+ messages in thread
From: Fuqian Huang @ 2019-06-27 17:40 UTC (permalink / raw)
  Cc: Fuqian Huang, Rafael J. Wysocki, Len Brown, Pavel Machek,
	linux-pm, linux-kernel

kmalloc + memset(0) -> kzalloc

Signed-off-by: Fuqian Huang <huangfq.daxian@gmail.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)
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 43/87] kernel: power: replace kmalloc and memset with kzalloc
  2019-06-27 17:40 [PATCH 43/87] kernel: power: replace kmalloc and memset with kzalloc Fuqian Huang
@ 2019-06-27 19:56 ` Pavel Machek
  0 siblings, 0 replies; 2+ messages in thread
From: Pavel Machek @ 2019-06-27 19:56 UTC (permalink / raw)
  To: Fuqian Huang; +Cc: Rafael J. Wysocki, Len Brown, linux-pm, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 805 bytes --]

On Fri 2019-06-28 01:40:48, Fuqian Huang wrote:
> kmalloc + memset(0) -> kzalloc
> 
> Signed-off-by: Fuqian Huang <huangfq.daxian@gmail.com>

Acked-by: Pavel Machek <pavel@ucw.cz>

> @@ -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)

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-06-27 19:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-27 17:40 [PATCH 43/87] kernel: power: replace kmalloc and memset with kzalloc Fuqian Huang
2019-06-27 19:56 ` Pavel Machek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).