From: Markus Elfring <Markus.Elfring@web.de>
To: Bhoomika Kadabi <bhoomikak@vayavyalabs.com>,
Manjunath Hadli <manjunath.hadli@vayavyalabs.com>,
Pavitrakumar Managutte <pavitrakumarm@vayavyalabs.com>,
Ruud Derwig <Ruud.Derwig@synopsys.com>,
linux-crypto@vger.kernel.org, devicetree@vger.kernel.org,
Herbert Xu <herbert@gondor.apana.org.au>,
Rob Herring <robh@kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
Aditya Kulkarni <adityak@vayavyalabs.com>,
Conor Dooley <conor+dt@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
T Pratham <t-pratham@ti.com>
Subject: Re: [PATCH v7 2/4] Add SPAcc ahash support
Date: Thu, 16 Oct 2025 20:43:22 +0200 [thread overview]
Message-ID: <fe4d7cd9-0566-4d1b-97c0-91cc1f952077@web.de> (raw)
In-Reply-To: <20251007065020.495008-3-pavitrakumarm@vayavyalabs.com>
…
> +++ b/drivers/crypto/dwc-spacc/spacc_ahash.c
> @@ -0,0 +1,980 @@
…
> +static int do_shash(struct device *dev, unsigned char *name,
…
> +{
…
> + sdesc = kmalloc(size, GFP_KERNEL);
> + if (!sdesc) {
> + rc = -ENOMEM;
> + goto do_shash_err;
> + }
…
> +do_shash_err:
> + crypto_free_shash(hash);
> + kfree(sdesc);
> +
> + return rc;
> +}
…
* You may use an additional label for better exception handling.
Or
* Would you like to benefit more from the attribute “__free(kfree)”?
https://elixir.bootlin.com/linux/v6.17.1/source/include/linux/slab.h#L476
…
> +/* Crypto engine hash operation */
> +static int spacc_hash_do_one_request(struct crypto_engine *engine, void *areq)
> +{
…
> + tctx->tmp_sgl = kmalloc(sizeof(*tctx->tmp_sgl) * 2, GFP_KERNEL);
> +
> + if (!tctx->tmp_sgl)
* Please omit a blank line between such statements.
* Can a kmalloc_array() call be helpful here?
…
> + kfree(tctx->tmp_sgl);
> + tctx->tmp_sgl = NULL;
> + local_bh_disable();
> + crypto_finalize_hash_request(engine, req, rc);
> + local_bh_enable();
> + return 0;
> + }
…
Please avoid duplicate source code in such a function implementation.
Regards,
Markus
next prev parent reply other threads:[~2025-10-16 18:43 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-07 6:50 [PATCH v7 0/4] Add SPAcc Crypto Driver Pavitrakumar Managutte
2025-10-07 6:50 ` [PATCH v7 1/4] dt-bindings: crypto: Document support for SPAcc Pavitrakumar Managutte
2025-10-07 6:50 ` [PATCH v7 2/4] Add SPAcc ahash support Pavitrakumar Managutte
2025-10-10 6:52 ` T Pratham
2025-10-17 8:33 ` Pavitrakumar Managutte
2025-10-16 18:15 ` Markus Elfring
2025-10-17 8:37 ` Pavitrakumar Managutte
2025-10-16 18:43 ` Markus Elfring [this message]
2025-10-17 9:00 ` Pavitrakumar Managutte
2025-10-17 11:06 ` Markus Elfring
2025-10-26 11:39 ` Pavitrakumar Managutte
2025-10-07 6:50 ` [PATCH v7 3/4] Add SPAcc AUTODETECT Support Pavitrakumar Managutte
2025-10-07 6:50 ` [PATCH v7 4/4] Add SPAcc Kconfig and Makefile Pavitrakumar Managutte
2025-10-10 6:57 ` [PATCH v7 0/4] Add SPAcc Crypto Driver T Pratham
2025-10-16 11:50 ` Pavitrakumar Managutte
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=fe4d7cd9-0566-4d1b-97c0-91cc1f952077@web.de \
--to=markus.elfring@web.de \
--cc=Ruud.Derwig@synopsys.com \
--cc=adityak@vayavyalabs.com \
--cc=bhoomikak@vayavyalabs.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=herbert@gondor.apana.org.au \
--cc=krzk+dt@kernel.org \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=manjunath.hadli@vayavyalabs.com \
--cc=pavitrakumarm@vayavyalabs.com \
--cc=robh@kernel.org \
--cc=t-pratham@ti.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).