Message ID | 20200127165646.19806-4-andrew.smirnov@gmail.com (mailing list archive) |
---|---|
State | Changes Requested |
Delegated to: | Herbert Xu |
Headers | show |
Series | enable CAAM's HWRNG as default | expand |
On 1/27/2020 6:57 PM, Andrey Smirnov wrote: > Use devm_kzalloc() to allocate JR data in order to make sure that it > is initialized consistently every time. > The commit message is a bit vague. I assume this is needed in patch 4/9, which adds a new member (hwrng) in caam_drv_private_jr structure. If so, it's probably better to have the change merged into patch 4/9. Horia
On Tue, Feb 11, 2020 at 10:23 AM Horia Geanta <horia.geanta@nxp.com> wrote: > > On 1/27/2020 6:57 PM, Andrey Smirnov wrote: > > Use devm_kzalloc() to allocate JR data in order to make sure that it > > is initialized consistently every time. > > > The commit message is a bit vague. > > I assume this is needed in patch 4/9, which adds a new member (hwrng) > in caam_drv_private_jr structure. > > If so, it's probably better to have the change merged into patch 4/9. > Yes, it is specifically needed for 4/9, but it's generally a good practice to zero out allocated memory, so I made it a separate patch. Will fold it into 4/9, since that's what you prefer. Thanks, Andrey Smirnov
diff --git a/drivers/crypto/caam/jr.c b/drivers/crypto/caam/jr.c index fc97cde27059..a627de959b1e 100644 --- a/drivers/crypto/caam/jr.c +++ b/drivers/crypto/caam/jr.c @@ -505,7 +505,7 @@ static int caam_jr_probe(struct platform_device *pdev) int error; jrdev = &pdev->dev; - jrpriv = devm_kmalloc(jrdev, sizeof(*jrpriv), GFP_KERNEL); + jrpriv = devm_kzalloc(jrdev, sizeof(*jrpriv), GFP_KERNEL); if (!jrpriv) return -ENOMEM;
Use devm_kzalloc() to allocate JR data in order to make sure that it is initialized consistently every time. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Cc: Chris Healy <cphealy@gmail.com> Cc: Lucas Stach <l.stach@pengutronix.de> Cc: Horia Geantă <horia.geanta@nxp.com> Cc: Herbert Xu <herbert@gondor.apana.org.au> Cc: Iuliana Prodan <iuliana.prodan@nxp.com> Cc: linux-crypto@vger.kernel.org Cc: linux-kernel@vger.kernel.org Cc: linux-imx@nxp.com --- drivers/crypto/caam/jr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)