Skip to content

Commit 1ed9b96

Browse files
tititiou36Lorenzo Pieralisi
authored andcommitted
PCI: xgene-msi: Use bitmap_zalloc() when applicable
'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. Link: https://lore.kernel.org/r/32f3bc1fbfbd6ee0815e565012904758ca9eff7e.1635019243.git.christophe.jaillet@wanadoo.fr Signed-off-by: Christophe JAILLET <[email protected]> Signed-off-by: Lorenzo Pieralisi <[email protected]> Reviewed-by: Krzysztof Wilczyński <[email protected]>
1 parent fa55b7d commit 1ed9b96

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

drivers/pci/controller/pci-xgene-msi.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -269,9 +269,7 @@ static void xgene_free_domains(struct xgene_msi *msi)
269269

270270
static int xgene_msi_init_allocator(struct xgene_msi *xgene_msi)
271271
{
272-
int size = BITS_TO_LONGS(NR_MSI_VEC) * sizeof(long);
273-
274-
xgene_msi->bitmap = kzalloc(size, GFP_KERNEL);
272+
xgene_msi->bitmap = bitmap_zalloc(NR_MSI_VEC, GFP_KERNEL);
275273
if (!xgene_msi->bitmap)
276274
return -ENOMEM;
277275

@@ -360,7 +358,7 @@ static int xgene_msi_remove(struct platform_device *pdev)
360358

361359
kfree(msi->msi_groups);
362360

363-
kfree(msi->bitmap);
361+
bitmap_free(msi->bitmap);
364362
msi->bitmap = NULL;
365363

366364
xgene_free_domains(msi);

0 commit comments

Comments
 (0)