diff mbox series

[2/3] crypto: marvell/octeontx: Use the bitmap API to allocate bitmaps

Message ID 8653848bcd6f309565a6f161a6f5bcc820073a7f.1657455082.git.christophe.jaillet@wanadoo.fr (mailing list archive)
State Changes Requested
Delegated to: Herbert Xu
Headers show
Series [1/3] crypto: marvell/octeontx: Simplify bitmap declaration | expand

Commit Message

Christophe JAILLET July 10, 2022, 12:13 p.m. UTC
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@wanadoo.fr>
---
 drivers/crypto/marvell/octeontx/otx_cptpf_ucode.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/drivers/crypto/marvell/octeontx/otx_cptpf_ucode.c b/drivers/crypto/marvell/octeontx/otx_cptpf_ucode.c
index 40b482198ebc..407e1a3ae841 100644
--- a/drivers/crypto/marvell/octeontx/otx_cptpf_ucode.c
+++ b/drivers/crypto/marvell/octeontx/otx_cptpf_ucode.c
@@ -1598,7 +1598,7 @@  void otx_cpt_cleanup_eng_grps(struct pci_dev *pdev,
 	for (i = 0; i < OTX_CPT_MAX_ENGINE_GROUPS; i++) {
 		grp = &eng_grps->grp[i];
 		for (j = 0; j < OTX_CPT_MAX_ETYPES_PER_GRP; j++) {
-			kfree(grp->engs[j].bmap);
+			bitmap_free(grp->engs[j].bmap);
 			grp->engs[j].bmap = NULL;
 		}
 	}
@@ -1635,9 +1635,8 @@  int otx_cpt_init_eng_grps(struct pci_dev *pdev,
 		snprintf(grp->sysfs_info_name, OTX_CPT_UCODE_NAME_LENGTH,
 			 "engine_group%d", i);
 		for (j = 0; j < OTX_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 err;