linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] PCI: xgene-msi: Use bitmap_zalloc() when applicable
@ 2021-10-23 20:02 Christophe JAILLET
  2021-11-06 21:36 ` Krzysztof Wilczyński
  2021-11-29 17:40 ` Lorenzo Pieralisi
  0 siblings, 2 replies; 6+ messages in thread
From: Christophe JAILLET @ 2021-10-23 20:02 UTC (permalink / raw)
  To: toan, lorenzo.pieralisi, robh, kw, bhelgaas
  Cc: linux-pci, linux-arm-kernel, linux-kernel, kernel-janitors,
	Christophe JAILLET

'xgene_msi->bitmap' is a bitmap. So use 'bitmap_zalloc()' to simplify code,
improve the semantic and avoid some open-coded arithmetic in allocator
arguments.

Also change the corresponding 'kfree()' into 'bitmap_free()' to keep
consistency.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/pci/controller/pci-xgene-msi.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/pci/controller/pci-xgene-msi.c b/drivers/pci/controller/pci-xgene-msi.c
index c50ff279903c..bfa259781b69 100644
--- a/drivers/pci/controller/pci-xgene-msi.c
+++ b/drivers/pci/controller/pci-xgene-msi.c
@@ -269,9 +269,7 @@ static void xgene_free_domains(struct xgene_msi *msi)
 
 static int xgene_msi_init_allocator(struct xgene_msi *xgene_msi)
 {
-	int size = BITS_TO_LONGS(NR_MSI_VEC) * sizeof(long);
-
-	xgene_msi->bitmap = kzalloc(size, GFP_KERNEL);
+	xgene_msi->bitmap = bitmap_zalloc(NR_MSI_VEC, GFP_KERNEL);
 	if (!xgene_msi->bitmap)
 		return -ENOMEM;
 
@@ -360,7 +358,7 @@ static int xgene_msi_remove(struct platform_device *pdev)
 
 	kfree(msi->msi_groups);
 
-	kfree(msi->bitmap);
+	bitmap_free(msi->bitmap);
 	msi->bitmap = NULL;
 
 	xgene_free_domains(msi);
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-11-29 17:42 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-23 20:02 [PATCH] PCI: xgene-msi: Use bitmap_zalloc() when applicable Christophe JAILLET
2021-11-06 21:36 ` Krzysztof Wilczyński
2021-11-07  7:18   ` Christophe JAILLET
2021-11-08  0:56     ` Krzysztof Wilczyński
2021-11-08 19:57       ` Christophe JAILLET
2021-11-29 17:40 ` Lorenzo Pieralisi

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).