diff mbox

[4/4] crypto: caam: ctrl: Use devm_kcalloc()

Message ID 1440168570-13635-4-git-send-email-festevam@gmail.com (mailing list archive)
State Superseded
Delegated to: Herbert Xu
Headers show

Commit Message

Fabio Estevam Aug. 21, 2015, 2:49 p.m. UTC
From: Fabio Estevam <fabio.estevam@freescale.com>

From Documentation/CodingStyle:

"The preferred form for allocating a zeroed array is the following:

	p = kcalloc(n, sizeof(...), ...); "

, so do as suggested.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
 drivers/crypto/caam/ctrl.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Comments

Horia Geantă Aug. 21, 2015, 3:42 p.m. UTC | #1
On 8/21/2015 5:49 PM, Fabio Estevam wrote:
> From: Fabio Estevam <fabio.estevam@freescale.com>
> 
>>From Documentation/CodingStyle:
> 
> "The preferred form for allocating a zeroed array is the following:
> 
> 	p = kcalloc(n, sizeof(...), ...); "
> 
> , so do as suggested.
> 
> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>

While here, you could also address the following:
drivers/crypto/caam/caamalg.c:4317
drivers/crypto/caam/caamhash.c:1844
drivers/crypto/caam/caamrng.c:354
drivers/crypto/caam/jr.c:413
drivers/crypto/caam/jr.c:418
drivers/crypto/caam/jr.c:423
drivers/crypto/caam/jr.c:482
(and any other place that I might've missed).

Since related, I guess the changes (3/4, 4/4 and above) could live in a
single patch.

Thanks,
Horia


--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/crypto/caam/ctrl.c b/drivers/crypto/caam/ctrl.c
index aab8b2a..c9c5892 100644
--- a/drivers/crypto/caam/ctrl.c
+++ b/drivers/crypto/caam/ctrl.c
@@ -581,9 +581,8 @@  static int caam_probe(struct platform_device *pdev)
 		    of_device_is_compatible(np, "fsl,sec4.0-job-ring"))
 			rspec++;
 
-	ctrlpriv->jrpdev = devm_kzalloc(&pdev->dev,
-					sizeof(struct platform_device *) * rspec,
-					GFP_KERNEL);
+	ctrlpriv->jrpdev = devm_kcalloc(&pdev->dev, rspec,
+					sizeof(*ctrlpriv->jrpdev), GFP_KERNEL);
 	if (ctrlpriv->jrpdev == NULL) {
 		ret = -ENOMEM;
 		goto iounmap_ctrl;