linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] misc: Use kzalloc() instead of kmalloc() with flag GFP_ZERO.
@ 2019-12-23  1:51 Yi Wang
  2019-12-23 12:04 ` Greg KH
  0 siblings, 1 reply; 5+ messages in thread
From: Yi Wang @ 2019-12-23  1:51 UTC (permalink / raw)
  To: sudeep.dutt
  Cc: ashutosh.dixit, arnd, gregkh, vincent.whitchurch, alexios.zavras,
	tglx, allison, linux-kernel, xue.zhihong, wang.yi59, up2wing,
	wang.liang82, Huang Zijiang

From: Huang Zijiang <huang.zijiang@zte.com.cn>

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

Signed-off-by: Huang Zijiang <huang.zijiang@zte.com.cn>
Signed-off-by: Yi Wang <wang.yi59@zte.com.cn>
---
 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 7335759..c1f87a4 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


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

* Re: [PATCH] misc: Use kzalloc() instead of kmalloc() with flag GFP_ZERO.
  2019-12-23  1:51 [PATCH] misc: Use kzalloc() instead of kmalloc() with flag GFP_ZERO Yi Wang
@ 2019-12-23 12:04 ` Greg KH
  2019-12-23 21:42   ` Dixit, Ashutosh
  0 siblings, 1 reply; 5+ messages in thread
From: Greg KH @ 2019-12-23 12:04 UTC (permalink / raw)
  To: Yi Wang
  Cc: sudeep.dutt, ashutosh.dixit, arnd, vincent.whitchurch,
	alexios.zavras, tglx, allison, linux-kernel, xue.zhihong,
	up2wing, wang.liang82, Huang Zijiang

On Mon, Dec 23, 2019 at 09:51:58AM +0800, Yi Wang wrote:
> From: Huang Zijiang <huang.zijiang@zte.com.cn>
> 
> Use kzalloc instead of manually setting kmalloc
> with flag GFP_ZERO since kzalloc sets allocated memory
> to zero.
> 
> Signed-off-by: Huang Zijiang <huang.zijiang@zte.com.cn>
> Signed-off-by: Yi Wang <wang.yi59@zte.com.cn>
> ---
>  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 7335759..c1f87a4 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);

Odd indation :(

Always use checkpatch.pl on your patches to ensure you do not add new
problems.

How did this get past 2 different people???

greg k-h

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

* Re: [PATCH] misc: Use kzalloc() instead of kmalloc() with flag GFP_ZERO.
  2019-12-23 12:04 ` Greg KH
@ 2019-12-23 21:42   ` Dixit, Ashutosh
  0 siblings, 0 replies; 5+ messages in thread
From: Dixit, Ashutosh @ 2019-12-23 21:42 UTC (permalink / raw)
  To: Greg KH
  Cc: Yi Wang, sudeep.dutt, arnd, vincent.whitchurch, alexios.zavras,
	tglx, allison, linux-kernel, xue.zhihong, up2wing, wang.liang82,
	Huang Zijiang

On Mon, 23 Dec 2019 04:04:28 -0800, Greg KH wrote:
>
> On Mon, Dec 23, 2019 at 09:51:58AM +0800, Yi Wang wrote:
> > From: Huang Zijiang <huang.zijiang@zte.com.cn>
> >
> > Use kzalloc instead of manually setting kmalloc
> > with flag GFP_ZERO since kzalloc sets allocated memory
> > to zero.
> >
> > Signed-off-by: Huang Zijiang <huang.zijiang@zte.com.cn>
> > Signed-off-by: Yi Wang <wang.yi59@zte.com.cn>
> > ---
> >  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 7335759..c1f87a4 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);
>
> Odd indation :(
>
> Always use checkpatch.pl on your patches to ensure you do not add new
> problems.
>
> How did this get past 2 different people???

Sorry, didn't see the mail, it ended up in Junk. Thanks for catching it.

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

* Re: [PATCH] misc: Use kzalloc() instead of kmalloc() with flag GFP_ZERO.
  2020-02-12  9:54 Yi Wang
@ 2020-02-14 17:16 ` Greg KH
  0 siblings, 0 replies; 5+ messages in thread
From: Greg KH @ 2020-02-14 17:16 UTC (permalink / raw)
  To: Yi Wang
  Cc: sudeep.dutt, ashutosh.dixit, arnd, vincent.whitchurch,
	alexios.zavras, tglx, allison, linux-kernel, xue.zhihong,
	wang.liang82, Huang Zijiang

On Wed, Feb 12, 2020 at 05:54:07PM +0800, Yi Wang wrote:
> From: Huang Zijiang <huang.zijiang@zte.com.cn>
> 
> 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

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

* [PATCH] misc: Use kzalloc() instead of kmalloc() with flag GFP_ZERO.
@ 2020-02-12  9:54 Yi Wang
  2020-02-14 17:16 ` Greg KH
  0 siblings, 1 reply; 5+ messages in thread
From: Yi Wang @ 2020-02-12  9:54 UTC (permalink / raw)
  To: sudeep.dutt
  Cc: ashutosh.dixit, arnd, gregkh, vincent.whitchurch, alexios.zavras,
	tglx, allison, linux-kernel, xue.zhihong, wang.yi59,
	wang.liang82, Huang Zijiang

From: Huang Zijiang <huang.zijiang@zte.com.cn>

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 <huang.zijiang@zte.com.cn>
Signed-off-by: Yi Wang <wang.yi59@zte.com.cn>
---
 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


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

end of thread, other threads:[~2020-02-14 20:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-23  1:51 [PATCH] misc: Use kzalloc() instead of kmalloc() with flag GFP_ZERO Yi Wang
2019-12-23 12:04 ` Greg KH
2019-12-23 21:42   ` Dixit, Ashutosh
2020-02-12  9:54 Yi Wang
2020-02-14 17:16 ` Greg KH

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