[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <c0314fd119665918d2e6b098f7683aed50507455.1657455515.git.christophe.jaillet@wanadoo.fr>
Date: Sun, 10 Jul 2022 14:19:23 +0200
From: Christophe JAILLET <christophe.jaillet@...adoo.fr>
To: Boris Brezillon <bbrezillon@...nel.org>,
Arnaud Ebalard <arno@...isbad.org>,
Srujana Challa <schalla@...vell.com>,
Herbert Xu <herbert@...dor.apana.org.au>,
"David S. Miller" <davem@...emloft.net>
Cc: linux-kernel@...r.kernel.org, kernel-janitors@...r.kernel.org,
Christophe JAILLET <christophe.jaillet@...adoo.fr>,
linux-crypto@...r.kernel.org
Subject: [PATCH 2/3] crypto: octeontx2: Use the bitmap API to allocate bitmaps
Use bitmap_zalloc()/bitmap_free() instead of hand-writing them.
It is less verbose and it improves the semantic.
Signed-off-by: Christophe JAILLET <christophe.jaillet@...adoo.fr>
---
drivers/crypto/marvell/octeontx2/otx2_cptpf_ucode.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/crypto/marvell/octeontx2/otx2_cptpf_ucode.c b/drivers/crypto/marvell/octeontx2/otx2_cptpf_ucode.c
index f10050fead16..a28a310090e9 100644
--- a/drivers/crypto/marvell/octeontx2/otx2_cptpf_ucode.c
+++ b/drivers/crypto/marvell/octeontx2/otx2_cptpf_ucode.c
@@ -1351,7 +1351,7 @@ void otx2_cpt_cleanup_eng_grps(struct pci_dev *pdev,
for (i = 0; i < OTX2_CPT_MAX_ENGINE_GROUPS; i++) {
grp = &eng_grps->grp[i];
for (j = 0; j < OTX2_CPT_MAX_ETYPES_PER_GRP; j++) {
- kfree(grp->engs[j].bmap);
+ bitmap_free(grp->engs[j].bmap);
grp->engs[j].bmap = NULL;
}
}
@@ -1387,9 +1387,8 @@ int otx2_cpt_init_eng_grps(struct pci_dev *pdev,
grp->idx = i;
for (j = 0; j < OTX2_CPT_MAX_ETYPES_PER_GRP; j++) {
- grp->engs[j].bmap =
- kcalloc(BITS_TO_LONGS(eng_grps->engs_num),
- sizeof(long), GFP_KERNEL);
+ grp->engs[j].bmap = bitmap_zalloc(eng_grps->engs_num,
+ GFP_KERNEL);
if (!grp->engs[j].bmap) {
ret = -ENOMEM;
goto cleanup_eng_grps;
--
2.34.1
Powered by blists - more mailing lists