From: Julia Lawall Date: Sun, 20 Sep 2020 11:26:24 +0000 (+0200) Subject: media: saa7146: drop double zeroing X-Git-Tag: v5.10-rc1~175^2~103 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8cc72b9c706bc30e5314130bedc07e40497e9f67;p=thirdparty%2Fkernel%2Flinux.git media: saa7146: drop double zeroing 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/) // @@ expression x,n,flags; @@ x = - kcalloc + kmalloc_array (n,sizeof(struct scatterlist),flags) ... sg_init_table(x,n) // Signed-off-by: Julia Lawall Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- diff --git a/drivers/media/common/saa7146/saa7146_core.c b/drivers/media/common/saa7146/saa7146_core.c index 6b06ea590074c..21fb16cc5ca1e 100644 --- a/drivers/media/common/saa7146/saa7146_core.c +++ b/drivers/media/common/saa7146/saa7146_core.c @@ -140,7 +140,7 @@ static struct scatterlist* vmalloc_to_sg(unsigned char *virt, int nr_pages) struct page *pg; int i; - sglist = kcalloc(nr_pages, sizeof(struct scatterlist), GFP_KERNEL); + sglist = kmalloc_array(nr_pages, sizeof(struct scatterlist), GFP_KERNEL); if (NULL == sglist) return NULL; sg_init_table(sglist, nr_pages);