mbox series

[00/14] drop double zeroing

Message ID 1600601186-7420-1-git-send-email-Julia.Lawall@inria.fr
Headers show
Series drop double zeroing | expand

Message

Julia Lawall Sept. 20, 2020, 11:26 a.m. UTC
sg_init_table zeroes its first argument, so the allocation of that argument
doesn't have to.

---

 block/bsg-lib.c                                  |    2 +-
 drivers/dma/sh/rcar-dmac.c                       |    2 +-
 drivers/dma/sh/shdma-base.c                      |    2 +-
 drivers/infiniband/hw/efa/efa_verbs.c            |    2 +-
 drivers/media/common/saa7146/saa7146_core.c      |    2 +-
 drivers/misc/mic/scif/scif_nodeqp.c              |    2 +-
 drivers/net/ethernet/freescale/dpaa2/dpaa2-eth.c |    2 +-
 drivers/net/wireless/intel/iwlwifi/fw/dbg.c      |    2 +-
 drivers/pci/p2pdma.c                             |    2 +-
 drivers/spi/spi-topcliff-pch.c                   |    4 ++--
 drivers/target/target_core_rd.c                  |    2 +-
 drivers/tty/serial/pch_uart.c                    |    2 +-
 net/rds/rdma.c                                   |    2 +-
 net/sunrpc/xprtrdma/frwr_ops.c                   |    2 +-
 14 files changed, 15 insertions(+), 15 deletions(-)

Comments

Chuck Lever Sept. 20, 2020, 3:37 p.m. UTC | #1
Thanks, Julia!

> On Sep 20, 2020, at 7:26 AM, Julia Lawall <Julia.Lawall@inria.fr> wrote:
> 
> sg_init_table zeroes its first argument, so the allocation of that argument
> doesn't have to.
> 
> the semantic patch that makes this change is as follows:
> (http://coccinelle.lip6.fr/)
> 
> // <smpl>
> @@
> expression x,n,flags;
> @@
> 
> x = 
> - kcalloc
> + kmalloc_array
>  (n,sizeof(*x),flags)
> ...
> sg_init_table(x,n)
> // </smpl>
> 
> Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>

Acked-by: Chuck Lever <chuck.lever@oracle.com>

This one goes to Anna.


> ---
> net/sunrpc/xprtrdma/frwr_ops.c |    2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff -u -p a/net/sunrpc/xprtrdma/frwr_ops.c b/net/sunrpc/xprtrdma/frwr_ops.c
> --- a/net/sunrpc/xprtrdma/frwr_ops.c
> +++ b/net/sunrpc/xprtrdma/frwr_ops.c
> @@ -124,7 +124,7 @@ int frwr_mr_init(struct rpcrdma_xprt *r_
> 	if (IS_ERR(frmr))
> 		goto out_mr_err;
> 
> -	sg = kcalloc(depth, sizeof(*sg), GFP_NOFS);
> +	sg = kmalloc_array(depth, sizeof(*sg), GFP_NOFS);
> 	if (!sg)
> 		goto out_list_err;
> 
> 

--
Chuck Lever
David Miller Sept. 21, 2020, 2:09 a.m. UTC | #2
From: Julia Lawall <Julia.Lawall@inria.fr>

Date: Sun, 20 Sep 2020 13:26:15 +0200

> sg_init_table zeroes its first argument, so the allocation of that argument

> doesn't have to.

> 

> the semantic patch that makes this change is as follows:

> (http://coccinelle.lip6.fr/)

> 

> // <smpl>

> @@

> expression x,n,flags;

> @@

> 

> x = 

> - kcalloc

> + kmalloc_array

>   (n,sizeof(struct scatterlist),flags)

> ...

> sg_init_table(x,n)

> // </smpl>

> 

> Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>


Applied.
David Miller Sept. 21, 2020, 2:09 a.m. UTC | #3
From: Julia Lawall <Julia.Lawall@inria.fr>
Date: Sun, 20 Sep 2020 13:26:19 +0200

> sg_init_table zeroes its first argument, so the allocation of that argument
> doesn't have to.
> 
> the semantic patch that makes this change is as follows:
> (http://coccinelle.lip6.fr/)
> 
> // <smpl>
> @@
> expression x,n,flags;
> @@
> 
> x = 
> - kcalloc
> + kmalloc_array
>   (n,sizeof(*x),flags)
> ...
> sg_init_table(x,n)
> // </smpl>
> 
> Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr>

Applied.
Mark Brown Sept. 23, 2020, 3:16 p.m. UTC | #4
On Wed, Sep 23, 2020 at 05:10:33PM +0200, Rolf Reintjes wrote:
> On 21.09.20 18:58, Mark Brown wrote:

> I do not understand which of the 14 patches you applied. Your mail responds
> to the 00/14 mail.

As the mail you're replying to says:

> > [1/1] spi/topcliff-pch: drop double zeroing
> >        commit: ca03dba30f2b8ff45a2972c6691e4c96d8c52b3b
Martin K. Petersen Oct. 13, 2020, 10:42 p.m. UTC | #5
On Sun, 20 Sep 2020 13:26:12 +0200, Julia Lawall wrote:

> sg_init_table zeroes its first argument, so the allocation of that argument
> doesn't have to.

Applied to 5.10/scsi-queue, thanks!

[02/14] scsi: target: rd: Drop double zeroing
        https://git.kernel.org/mkp/scsi/c/4b217e015b75