2020-02-12 10:11:55

by Yi Wang

[permalink] [raw]
Subject: [PATCH] misc: Use kzalloc() instead of kmalloc() with flag GFP_ZERO.

From: Huang Zijiang <[email protected]>

Use kzalloc instead of manually setting kmalloc
with flag GFP_ZERO since kzalloc sets allocated memory
to zero.

Change in v2:
add indation

Signed-off-by: Huang Zijiang <[email protected]>
Signed-off-by: Yi Wang <[email protected]>
---
drivers/misc/mic/host/mic_boot.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/misc/mic/host/mic_boot.c b/drivers/misc/mic/host/mic_boot.c
index 4f2d921..fb5b398 100644
--- a/drivers/misc/mic/host/mic_boot.c
+++ b/drivers/misc/mic/host/mic_boot.c
@@ -137,7 +137,7 @@ static void *__mic_dma_alloc(struct device *dev, size_t size,
struct scif_hw_dev *scdev = dev_get_drvdata(dev);
struct mic_device *mdev = scdev_to_mdev(scdev);
dma_addr_t tmp;
- void *va = kmalloc(size, gfp | __GFP_ZERO);
+ void *va = kzalloc(size, gfp);

if (va) {
tmp = mic_map_single(mdev, va, size);
--
1.9.1


2020-02-14 20:03:34

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH] misc: Use kzalloc() instead of kmalloc() with flag GFP_ZERO.

On Wed, Feb 12, 2020 at 05:54:07PM +0800, Yi Wang wrote:
> From: Huang Zijiang <[email protected]>
>
> Use kzalloc instead of manually setting kmalloc
> with flag GFP_ZERO since kzalloc sets allocated memory
> to zero.
>
> Change in v2:
> add indation

This list of what changed should go below the --- line. I've fixed it
up now, no need to redo this.

thanks,

greg k-h