All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/8] Transform kzalloc calls to kcalloc
@ 2015-03-10 11:52 Navya Sri Nizamkari
  2015-03-10 11:57 ` [PATCH v2 1/8] staging: rtl8188eu: Use kcalloc instead of kzalloc Navya Sri Nizamkari
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: Navya Sri Nizamkari @ 2015-03-10 11:52 UTC (permalink / raw)
  To: outreachy-kernel

[changes in v2]
In version v2, I break the original patchset into two.
One for kmalloc -> k{z,c}alloc and other for 
kzalloc -> kcalloc. This patchset includes patches for
kzalloc to kmalloc conversion.

[original cover letter]
This patchset changes some kzalloc calls to kcalloc and
kmalloc to kzalloc.

 The semantic patch used to make this change is:

 @@
 type T, T2;
 expression x;
 identifier f,f1;
 expression E1,E2,E3,E4;
 statement S,S1,S2;
 @@
 - x = (T)kmalloc(E1,E2)
 + x = kzalloc(E1,E2)
 ... when != \(f(...,x,...)\|<+...x...+>=E3\)
 when != \(while(...) S\|for(...;...;...) S\)
 (
 if ((x!=NULL)&&...) {
 ... when != \(f1(...,x,...)\|<+...x...+>=E4\)
 when != \(while(...) S1\|for(...;...;...) S1\)
 - memset((T2)x,0,E1);
 ...
 } else S2
 |
 - memset((T2)x,0,E1);
 )
 @@
 type T, T2;
 type T1;
 T1 *x;
 T1 *y;
 identifier f,f1;
 expression E2,E3,E4;
 statement S,S1,S2;
 @@
 - x = (T)kmalloc(sizeof(T1),E2)
 + x = kzalloc(sizeof(T1),E2)
 ... when != \(f(...,x,...)\|<+...x...+>=E3\)
 when != \(while(...) S\|for(...;...;...) S\)
 (
 if ((x!=NULL)&&...) {
 ... when != \(f1(...,x,...)\|<+...x...+>=E4\)
 when != \(while(...) S1\|for(...;...;...) S1\)
 - memset((T2)x,0,sizeof(*y));
 ...
 } else S2
 |
 - memset((T2)x,0,sizeof(*y));
 )
 @@
 type T, T2;
 type T1;
 T1 *x;
 T1 *y;
 identifier f,f1;
 expression E,E2,E3,E4;
 statement S,S1,S2;
 @@
 - x = (T)kmalloc(sizeof(T1)*E,E2)
 + x = kzalloc(sizeof(T1)*E,E2)
 ... when != \(f(...,x,...)\|<+...x...+>=E3\)
 when != \(while(...) S\|for(...;...;...) S\)
 (
 if ((x!=NULL)&&...) {
 ... when != \(f1(...,x,...)\|<+...x...+>=E4\)
 when != \(while(...) S1\|for(...;...;...) S1\)
 - memset((T2)x,0,sizeof(*y)*E);
 ...
 } else S2
 |
 - memset((T2)x,0,sizeof(*y)*E);
 )
 @@
 type T, T2;
 type T1;
 T1 *x;
 T1 *y;
 identifier f,f1;
 expression E2,E3,E4;
 statement S,S1,S2;
 @@
 - x = (T)kmalloc(sizeof(*y),E2)
 + x = kzalloc(sizeof(*y),E2)
 ... when != \(f(...,x,...)\|<+...x...+>=E3\)
 when != \(while(...) S\|for(...;...;...) S\)
 (
 if ((x!=NULL)&&...) {
 ... when != \(f1(...,x,...)\|<+...x...+>=E4\)
 when != \(while(...) S1\|for(...;...;...) S1\)
 - memset((T2)x,0,sizeof(T1));
 ...
 } else S2
 |
 - memset((T2)x,0,sizeof(T1));
 )
 @@
 type T, T2;
 type T1;
 T1 *x;
 T1 *y;
 identifier f,f1;
 expression E,E2,E3,E4;
 statement S,S1,S2;
 @@
 - x = (T)kmalloc(sizeof(*y)*E,E2)
 + x = kzalloc(sizeof(*y)*E,E2)
 ... when != \(f(...,x,...)\|<+...x...+>=E3\)
 when != \(while(...) S\|for(...;...;...) S\)
 (
 if ((x!=NULL)&&...) {
 ... when != \(f1(...,x,...)\|<+...x...+>=E4\)
 when != \(while(...) S1\|for(...;...;...) S1\)
 - memset((T2)x,0,sizeof(T1)*E);
 ...
 } else S2
 |
 - memset((T2)x,0,sizeof(T1)*E);
 )
 @ disable neg_if, mult_comm @
 type T, T2;
 expression x;
 identifier f,f1;
 expression E0,E1,E2,E3,E4;
 statement S,S1,S2;
 @@
 - x = (T)kmalloc(E0 * E1,E2)
 + x = kzalloc(E0 * E1,E2)
 ... when != \(f(...,x,...)\|<+...x...+>=E3\)
 when != \(while(...) S\|for(...;...;...) S\)
 (
 if ((x!=NULL)&&...) {
 ... when != \(f1(...,x,...)\|<+...x...+>=E4\)
 when != \(while(...) S1\|for(...;...;...) S1\)
 - memset((T2)x,0,E1 * E0);
 ...
 } else S2
 |
 - memset((T2)x,0,E1 * E0);
 )
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 // have to duplicate everything again to make a version with no braces
 //\(x->fld\|f(...,x,...)\|x=E\)
 @@
 type T, T2;
 expression x;
 identifier f;
 expression E1,E2,E3;
 statement S,S2;
 @@
 - x = (T)kmalloc(E1,E2)
 + x = kzalloc(E1,E2)
 ... when != \(f(...,x,...)\|<+...x...+>=E3\)
 when != \(while(...) S\|for(...;...;...) S\)
 (
 - if ((x!=NULL)&&...) memset((T2)x,0,E1);
 |
 + if (!x)
 - if ((x!=NULL)&&...) memset((T2)x,0,E1); else
 S2
 )
 @ @
 type T, T2;
 type T1;
 T1 *x;
 T1 *y;
 identifier f;
 expression E2,E3;
 statement S,S2;
 @@
 - x = (T)kmalloc(sizeof(T1),E2)
 + x = kzalloc(sizeof(T1),E2)
 ... when != \(f(...,x,...)\|<+...x...+>=E3\)
 when != \(while(...) S\|for(...;...;...) S\)
 (
 - if ((x!=NULL)&&...) memset((T2)x,0,sizeof(*y));
 |
 + if (!x)
 - if ((x!=NULL)&&...) memset((T2)x,0,sizeof(*y)); else
 S2
 )
 @@
 type T, T2;
 type T1;
 T1 *x;
 T1 *y;
 identifier f;
 expression E,E2,E3;
 statement S,S2;
 @@
 - x = (T)kmalloc(sizeof(T1)*E,E2)
 + x = kzalloc(sizeof(T1)*E,E2)
 ... when != \(f(...,x,...)\|<+...x...+>=E3\)
 when != \(while(...) S\|for(...;...;...) S\)
 (
 - if ((x!=NULL)&&...) memset((T2)x,0,sizeof(*y)*E);
 |
 + if (!x)
 - if ((x!=NULL)&&...) memset((T2)x,0,sizeof(*y)*E); else
 S2
 )
 @@
 type T, T2;
 type T1;
 T1 *x;
 T1 *y;
 identifier f;
 expression E2,E3;
 statement S,S2;
 @@
 - x = (T)kmalloc(sizeof(*y),E2)
 + x = kzalloc(sizeof(*y),E2)
 ... when != \(f(...,x,...)\|<+...x...+>=E3\)
 when != \(while(...) S\|for(...;...;...) S\)
 (
 - if ((x!=NULL)&&...) memset((T2)x,0,sizeof(T1));
 |
 + if (!x)
 - if ((x!=NULL)&&...) memset((T2)x,0,sizeof(T1)); else
 S2
 )
 @@
 type T, T2;
 type T1;
 T1 *x;
 T1 *y;
 identifier f;
 expression E,E2,E3;
 statement S,S2;
 @@
 - x = (T)kmalloc(sizeof(*y)*E,E2)
 + x = kzalloc(sizeof(*y)*E,E2)
 ... when != \(f(...,x,...)\|<+...x...+>=E3\)
 when != \(while(...) S\|for(...;...;...) S\)
 (
 - if ((x!=NULL)&&...) memset((T2)x,0,sizeof(T1)*E);
 |
 + if (!x)
 - if ((x!=NULL)&&...) memset((T2)x,0,sizeof(T1)*E); else
 S2
 )
 @ disable neg_if, mult_comm @
 type T, T2;
 expression x;
 identifier f;
 expression E0,E1,E2,E3;
 statement S,S2;
 @@
 - x = (T)kmalloc(E0 * E1,E2)
 + x = kzalloc(E0 * E1,E2)
 ... when != \(f(...,x,...)\|<+...x...+>=E3\)
 when != \(while(...) S\|for(...;...;...) S\)
 (
 - if ((x!=NULL)&&...) memset((T2)x,0,E1 * E0);
 |
 + if (!x)
 - if ((x!=NULL)&&...) memset((T2)x,0,E1 * E0); else
 S2
 )
 // ---------------------------------------------------------------------
 @@
 expression E;
 statement S;
 @@
 kzalloc(...)
 ...
 if (E) S
 - else { }
 // ---------------------------------------------------------------------
 // ---------------------------------------------------------------------
 @@
 expression E1,E2,E3;
 @@
 - kzalloc(E1*sizeof(E2),E3)
 + kcalloc(E1,sizeof(E2),E3)
 @@
 expression E1,E3;
 type T;
 @@
 - kzalloc(E1*sizeof(T),E3)
 + kcalloc(E1,sizeof(T),E3)
 @@
 expression E1,E2,E3,E4;
 @@
 - kzalloc(E1*E2*sizeof(E3),E4)
 + kcalloc(E1*E2,sizeof(E3),E4)
 @@
 expression E1,E2,E3;
 type T;
 @@
 - kzalloc(E1*E2*sizeof(T),E3)
 + kcalloc(E1*E2,sizeof(T),E3)
 @@
 expression E1,E2,E3,E4;
 @@
 - kzalloc(sizeof(E3)*E1*E2,E4)
 + kcalloc(E1*E2,sizeof(E3),E4)
 @@
 expression E1,E2,E3;
 type T;
 @@
 - kzalloc(sizeof(T)*E1*E2,E3)
 + kcalloc(E1*E2,sizeof(T),E3)
 @@
 constant E1;
 expression E2,E3;
 @@
 - kzalloc(E1*E2,E3)
 + kcalloc(E1,E2,E3)

Navya Sri Nizamkari (8):
  staging: rtl8188eu: Use kcalloc instead of kzalloc.
  staging: rtl8188eu: Use kcalloc instead of kzalloc
  staging: dgnc: Use kcalloc instead of kzalloc.
  staging: iio: Use kcalloc instead of kzalloc.
  staging: iio: Use kcalloc instead of kzalloc
  staging: media: Use kcalloc instead of kzalloc.
  staging: media: Use kcalloc instead of kzalloc
  staging: unisys: Use kcalloc instead of kzalloc.

 drivers/staging/dgnc/dgnc_driver.c                   | 2 +-
 drivers/staging/iio/accel/lis3l02dq_ring.c           | 2 +-
 drivers/staging/iio/adc/ad7280a.c                    | 5 +++--
 drivers/staging/media/bcm2048/radio-bcm2048.c        | 2 +-
 drivers/staging/media/davinci_vpfe/vpfe_mc_capture.c | 7 ++++---
 drivers/staging/rtl8188eu/core/rtw_xmit.c            | 3 ++-
 drivers/staging/rtl8188eu/hal/rtl8188eu_recv.c       | 2 +-
 drivers/staging/unisys/visorutil/procobjecttree.c    | 6 +++---
 8 files changed, 16 insertions(+), 13 deletions(-)

-- 
1.9.1



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

* [PATCH v2 1/8] staging: rtl8188eu: Use kcalloc instead of kzalloc.
  2015-03-10 11:52 [PATCH v2 0/8] Transform kzalloc calls to kcalloc Navya Sri Nizamkari
@ 2015-03-10 11:57 ` Navya Sri Nizamkari
  2015-03-10 11:59 ` [PATCH v2 2/8] " Navya Sri Nizamkari
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Navya Sri Nizamkari @ 2015-03-10 11:57 UTC (permalink / raw)
  To: outreachy-kernel

This patch uses kcalloc instead of kzalloc function.
A coccinelle script was used to make this change.

Signed-off-by: Navya Sri Nizamkari <navyasri.tech@gmail.com>
---
Changes in v2:
     - Make commit message shorter by removing the
       coccinelle script.

 drivers/staging/rtl8188eu/core/rtw_xmit.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8188eu/core/rtw_xmit.c b/drivers/staging/rtl8188eu/core/rtw_xmit.c
index 7a71df1..7ed60ab 100644
--- a/drivers/staging/rtl8188eu/core/rtw_xmit.c
+++ b/drivers/staging/rtl8188eu/core/rtw_xmit.c
@@ -1634,7 +1634,8 @@ void rtw_alloc_hwxmits(struct adapter *padapter)
 
 	pxmitpriv->hwxmit_entry = HWXMIT_ENTRY;
 
-	pxmitpriv->hwxmits = kzalloc(sizeof(struct hw_xmit) * pxmitpriv->hwxmit_entry, GFP_KERNEL);
+	pxmitpriv->hwxmits = kcalloc(pxmitpriv->hwxmit_entry,
+				     sizeof(struct hw_xmit), GFP_KERNEL);
 
 	hwxmits = pxmitpriv->hwxmits;
 
-- 
1.9.1



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

* [PATCH v2 2/8] staging: rtl8188eu: Use kcalloc instead of kzalloc
  2015-03-10 11:52 [PATCH v2 0/8] Transform kzalloc calls to kcalloc Navya Sri Nizamkari
  2015-03-10 11:57 ` [PATCH v2 1/8] staging: rtl8188eu: Use kcalloc instead of kzalloc Navya Sri Nizamkari
@ 2015-03-10 11:59 ` Navya Sri Nizamkari
  2015-03-10 12:01 ` [PATCH v2 3/8] staging: dgnc: " Navya Sri Nizamkari
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Navya Sri Nizamkari @ 2015-03-10 11:59 UTC (permalink / raw)
  To: outreachy-kernel

This patch uses kcalloc instead of kzalloc function.
A coccinelle script was used to make this change.

Signed-off-by: Navya Sri Nizamkari <navyasri.tech@gmail.com>
---
Changes in v2:
     - Make commit message shorter by removing the
       coccinelle script.

 drivers/staging/rtl8188eu/hal/rtl8188eu_recv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8188eu/hal/rtl8188eu_recv.c b/drivers/staging/rtl8188eu/hal/rtl8188eu_recv.c
index bc275b2..06d1e65 100644
--- a/drivers/staging/rtl8188eu/hal/rtl8188eu_recv.c
+++ b/drivers/staging/rtl8188eu/hal/rtl8188eu_recv.c
@@ -42,7 +42,7 @@ int	rtl8188eu_init_recv_priv(struct adapter *padapter)
 	_rtw_init_queue(&precvpriv->free_recv_buf_queue);
 
 	precvpriv->pallocated_recv_buf =
-		kzalloc(NR_RECVBUFF * sizeof(struct recv_buf), GFP_KERNEL);
+		kcalloc(NR_RECVBUFF, sizeof(struct recv_buf), GFP_KERNEL);
 	if (precvpriv->pallocated_recv_buf == NULL) {
 		res = _FAIL;
 		RT_TRACE(_module_rtl871x_recv_c_, _drv_err_,
-- 
1.9.1



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

* [PATCH v2 3/8] staging: dgnc: Use kcalloc instead of kzalloc.
  2015-03-10 11:52 [PATCH v2 0/8] Transform kzalloc calls to kcalloc Navya Sri Nizamkari
  2015-03-10 11:57 ` [PATCH v2 1/8] staging: rtl8188eu: Use kcalloc instead of kzalloc Navya Sri Nizamkari
  2015-03-10 11:59 ` [PATCH v2 2/8] " Navya Sri Nizamkari
@ 2015-03-10 12:01 ` Navya Sri Nizamkari
  2015-03-10 12:02 ` [PATCH v2 4/8] staging: iio: " Navya Sri Nizamkari
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Navya Sri Nizamkari @ 2015-03-10 12:01 UTC (permalink / raw)
  To: outreachy-kernel

This patch uses kcalloc instead of kzalloc function.
A coccinelle script was used to make this change.

Signed-off-by: Navya Sri Nizamkari <navyasri.tech@gmail.com>
---
Changes in v2:
     - Make commit message shorter by removing the
       coccinelle script.
       
 drivers/staging/dgnc/dgnc_driver.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/dgnc/dgnc_driver.c b/drivers/staging/dgnc/dgnc_driver.c
index a2543cf..5990b1e 100644
--- a/drivers/staging/dgnc/dgnc_driver.c
+++ b/drivers/staging/dgnc/dgnc_driver.c
@@ -408,7 +408,7 @@ static int dgnc_found_board(struct pci_dev *pdev, int id)
 		return -ENOMEM;
 
 	/* make a temporary message buffer for the boot messages */
-	brd->msgbuf_head = kzalloc(sizeof(u8) * 8192, GFP_KERNEL);
+	brd->msgbuf_head = kcalloc(8192, sizeof(u8), GFP_KERNEL);
 	brd->msgbuf = brd->msgbuf_head;
 
 	if (!brd->msgbuf) {
-- 
1.9.1



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

* [PATCH v2 4/8] staging: iio: Use kcalloc instead of kzalloc.
  2015-03-10 11:52 [PATCH v2 0/8] Transform kzalloc calls to kcalloc Navya Sri Nizamkari
                   ` (2 preceding siblings ...)
  2015-03-10 12:01 ` [PATCH v2 3/8] staging: dgnc: " Navya Sri Nizamkari
@ 2015-03-10 12:02 ` Navya Sri Nizamkari
  2015-03-10 12:04 ` [PATCH v2 5/8] " Navya Sri Nizamkari
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Navya Sri Nizamkari @ 2015-03-10 12:02 UTC (permalink / raw)
  To: outreachy-kernel

This patch uses kcalloc instead of kzalloc function.
A coccinelle script was used to make this change.

Signed-off-by: Navya Sri Nizamkari <navyasri.tech@gmail.com>
---
Changes in v2:
     - Make commit message shorter by removing the coccinelle
       script.
 drivers/staging/iio/adc/ad7280a.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/iio/adc/ad7280a.c b/drivers/staging/iio/adc/ad7280a.c
index 4d48707..e7d45ee 100644
--- a/drivers/staging/iio/adc/ad7280a.c
+++ b/drivers/staging/iio/adc/ad7280a.c
@@ -547,8 +547,9 @@ static int ad7280_attr_init(struct ad7280_state *st)
 {
 	int dev, ch, cnt;
 
-	st->iio_attr = kzalloc(sizeof(*st->iio_attr) * (st->slave_num + 1) *
-				AD7280A_CELLS_PER_DEV * 2, GFP_KERNEL);
+	st->iio_attr = kcalloc(2, sizeof(*st->iio_attr) *
+			       (st->slave_num + 1) * AD7280A_CELLS_PER_DEV,
+			       GFP_KERNEL);
 	if (st->iio_attr == NULL)
 		return -ENOMEM;
 
-- 
1.9.1



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

* [PATCH v2 5/8] staging: iio: Use kcalloc instead of kzalloc
  2015-03-10 11:52 [PATCH v2 0/8] Transform kzalloc calls to kcalloc Navya Sri Nizamkari
                   ` (3 preceding siblings ...)
  2015-03-10 12:02 ` [PATCH v2 4/8] staging: iio: " Navya Sri Nizamkari
@ 2015-03-10 12:04 ` Navya Sri Nizamkari
  2015-03-10 12:05 ` [PATCH v2 6/8] staging: media: " Navya Sri Nizamkari
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: Navya Sri Nizamkari @ 2015-03-10 12:04 UTC (permalink / raw)
  To: outreachy-kernel

This patch uses kcalloc instead of kzalloc function.
A coccinelle script was used to make this change.

Signed-off-by: Navya Sri Nizamkari <navyasri.tech@gmail.com>
---
Changes in v2:
     - Make commit message shorter by removing the
       coccinelle script.

 drivers/staging/iio/accel/lis3l02dq_ring.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/iio/accel/lis3l02dq_ring.c b/drivers/staging/iio/accel/lis3l02dq_ring.c
index 1fd9009..e6101bb 100644
--- a/drivers/staging/iio/accel/lis3l02dq_ring.c
+++ b/drivers/staging/iio/accel/lis3l02dq_ring.c
@@ -118,7 +118,7 @@ static int lis3l02dq_get_buffer_element(struct iio_dev *indio_dev,
 	int scan_count = bitmap_weight(indio_dev->active_scan_mask,
 				       indio_dev->masklength);
 
-	rx_array = kzalloc(4 * scan_count, GFP_KERNEL);
+	rx_array = kcalloc(4, scan_count, GFP_KERNEL);
 	if (rx_array == NULL)
 		return -ENOMEM;
 	ret = lis3l02dq_read_all(indio_dev, rx_array);
-- 
1.9.1



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

* [PATCH v2 6/8] staging: media: Use kcalloc instead of kzalloc.
  2015-03-10 11:52 [PATCH v2 0/8] Transform kzalloc calls to kcalloc Navya Sri Nizamkari
                   ` (4 preceding siblings ...)
  2015-03-10 12:04 ` [PATCH v2 5/8] " Navya Sri Nizamkari
@ 2015-03-10 12:05 ` Navya Sri Nizamkari
  2015-03-10 12:07 ` [PATCH v2 7/8] " Navya Sri Nizamkari
  2015-03-10 12:08 ` [PATCH v2 8/8] staging: unisys: " Navya Sri Nizamkari
  7 siblings, 0 replies; 9+ messages in thread
From: Navya Sri Nizamkari @ 2015-03-10 12:05 UTC (permalink / raw)
  To: outreachy-kernel

This patch uses kcalloc instead of kzalloc function.
A coccinelle script was used to make this change.

Signed-off-by: Navya Sri Nizamkari <navyasri.tech@gmail.com>
---
Changes in v2:
     - Make commit message shorter by removing the
       coccinelle script.

 drivers/staging/media/davinci_vpfe/vpfe_mc_capture.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/media/davinci_vpfe/vpfe_mc_capture.c b/drivers/staging/media/davinci_vpfe/vpfe_mc_capture.c
index a350a20..5742619 100644
--- a/drivers/staging/media/davinci_vpfe/vpfe_mc_capture.c
+++ b/drivers/staging/media/davinci_vpfe/vpfe_mc_capture.c
@@ -226,8 +226,8 @@ static int vpfe_enable_clock(struct vpfe_device *vpfe_dev)
 	if (!vpfe_cfg->num_clocks)
 		return 0;
 
-	vpfe_dev->clks = kzalloc(vpfe_cfg->num_clocks *
-				   sizeof(struct clock *), GFP_KERNEL);
+	vpfe_dev->clks = kcalloc(vpfe_cfg->num_clocks,
+				 sizeof(struct clock *), GFP_KERNEL);
 	if (vpfe_dev->clks == NULL)
 		return -ENOMEM;
 
@@ -346,7 +346,8 @@ static int register_i2c_devices(struct vpfe_device *vpfe_dev)
 	i2c_adap = i2c_get_adapter(1);
 	num_subdevs = vpfe_cfg->num_subdevs;
 	vpfe_dev->sd =
-		  kzalloc(sizeof(struct v4l2_subdev *)*num_subdevs, GFP_KERNEL);
+		  kcalloc(num_subdevs, sizeof(struct v4l2_subdev *),
+			  GFP_KERNEL);
 	if (vpfe_dev->sd == NULL)
 		return -ENOMEM;
 
-- 
1.9.1



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

* [PATCH v2 7/8] staging: media: Use kcalloc instead of kzalloc
  2015-03-10 11:52 [PATCH v2 0/8] Transform kzalloc calls to kcalloc Navya Sri Nizamkari
                   ` (5 preceding siblings ...)
  2015-03-10 12:05 ` [PATCH v2 6/8] staging: media: " Navya Sri Nizamkari
@ 2015-03-10 12:07 ` Navya Sri Nizamkari
  2015-03-10 12:08 ` [PATCH v2 8/8] staging: unisys: " Navya Sri Nizamkari
  7 siblings, 0 replies; 9+ messages in thread
From: Navya Sri Nizamkari @ 2015-03-10 12:07 UTC (permalink / raw)
  To: outreachy-kernel

This patch uses kcalloc instead of kzalloc function.
A coccinelle script was used to make this change.

Signed-off-by: Navya Sri Nizamkari <navyasri.tech@gmail.com>
---
Changes in v2:
     - Make commit message shorter by removing the
       coccinelle script.

 drivers/staging/media/bcm2048/radio-bcm2048.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/media/bcm2048/radio-bcm2048.c b/drivers/staging/media/bcm2048/radio-bcm2048.c
index 5382506..c68fa4a 100644
--- a/drivers/staging/media/bcm2048/radio-bcm2048.c
+++ b/drivers/staging/media/bcm2048/radio-bcm2048.c
@@ -1792,7 +1792,7 @@ static int bcm2048_get_rds_data(struct bcm2048_device *bdev, char *data)
 		goto unlock;
 	}
 
-	data_buffer = kzalloc(BCM2048_MAX_RDS_RADIO_TEXT*5, GFP_KERNEL);
+	data_buffer = kcalloc(BCM2048_MAX_RDS_RADIO_TEXT, 5, GFP_KERNEL);
 	if (!data_buffer) {
 		err = -ENOMEM;
 		goto unlock;
-- 
1.9.1



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

* [PATCH v2 8/8] staging: unisys: Use kcalloc instead of kzalloc.
  2015-03-10 11:52 [PATCH v2 0/8] Transform kzalloc calls to kcalloc Navya Sri Nizamkari
                   ` (6 preceding siblings ...)
  2015-03-10 12:07 ` [PATCH v2 7/8] " Navya Sri Nizamkari
@ 2015-03-10 12:08 ` Navya Sri Nizamkari
  7 siblings, 0 replies; 9+ messages in thread
From: Navya Sri Nizamkari @ 2015-03-10 12:08 UTC (permalink / raw)
  To: outreachy-kernel

This patch uses kcalloc instead of kzalloc function.
A coccinelle script was used to make this change.

Signed-off-by: Navya Sri Nizamkari <navyasri.tech@gmail.com>
---
Changes in v2:
     - Make commit message shorter by removing the
       coccinelle script.

 drivers/staging/unisys/visorutil/procobjecttree.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/unisys/visorutil/procobjecttree.c b/drivers/staging/unisys/visorutil/procobjecttree.c
index 0672e8c..dfd9e50 100644
--- a/drivers/staging/unisys/visorutil/procobjecttree.c
+++ b/drivers/staging/unisys/visorutil/procobjecttree.c
@@ -159,7 +159,7 @@ MYPROCTYPE *visor_proc_CreateType(struct proc_dir_entry *procDirRoot,
 			type->nProperties++;
 	while (type->name[type->nNames] != NULL)
 		type->nNames++;
-	type->procDirs = kzalloc((type->nNames + 1) *
+	type->procDirs = kcalloc((type->nNames + 1),
 				 sizeof(struct proc_dir_entry *),
 				 GFP_KERNEL | __GFP_NORETRY);
 	if (type->procDirs == NULL)
@@ -247,12 +247,12 @@ MYPROCOBJECT *visor_proc_CreateObject(MYPROCTYPE *type,
 			goto Away;
 	}
 	obj->procDirPropertyContexts =
-		kzalloc((type->nProperties + 1) *
+		kcalloc((type->nProperties + 1),
 			sizeof(struct proc_dir_entry_context),
 			GFP_KERNEL | __GFP_NORETRY);
 	if (obj->procDirPropertyContexts == NULL)
 		goto Away;
-	obj->procDirProperties = kzalloc((type->nProperties + 1) *
+	obj->procDirProperties = kcalloc((type->nProperties + 1),
 					 sizeof(struct proc_dir_entry *),
 					 GFP_KERNEL | __GFP_NORETRY);
 	if (obj->procDirProperties == NULL)
-- 
1.9.1



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

end of thread, other threads:[~2015-03-10 12:07 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-10 11:52 [PATCH v2 0/8] Transform kzalloc calls to kcalloc Navya Sri Nizamkari
2015-03-10 11:57 ` [PATCH v2 1/8] staging: rtl8188eu: Use kcalloc instead of kzalloc Navya Sri Nizamkari
2015-03-10 11:59 ` [PATCH v2 2/8] " Navya Sri Nizamkari
2015-03-10 12:01 ` [PATCH v2 3/8] staging: dgnc: " Navya Sri Nizamkari
2015-03-10 12:02 ` [PATCH v2 4/8] staging: iio: " Navya Sri Nizamkari
2015-03-10 12:04 ` [PATCH v2 5/8] " Navya Sri Nizamkari
2015-03-10 12:05 ` [PATCH v2 6/8] staging: media: " Navya Sri Nizamkari
2015-03-10 12:07 ` [PATCH v2 7/8] " Navya Sri Nizamkari
2015-03-10 12:08 ` [PATCH v2 8/8] staging: unisys: " Navya Sri Nizamkari

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.