Skip to content

Commit

Permalink
soc: ti: k3-ringacc: Use devm_bitmap_zalloc() when applicable
Browse files Browse the repository at this point in the history
'rings_inuse' and 'proxy_inuse' are bitmaps. So use 'devm_bitmap_zalloc()'
to simplify code and improve the semantic.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Nishanth Menon <nm@ti.com>
Link: https://lore.kernel.org/r/45544b0d97a7bea7764292852842adf5085a7700.1640276001.git.christophe.jaillet@wanadoo.fr
  • Loading branch information
Christophe JAILLET authored and Nishanth Menon committed Feb 2, 2022
1 parent e783362 commit a8eba8d
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions drivers/soc/ti/k3-ringacc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1402,12 +1402,10 @@ static int k3_ringacc_init(struct platform_device *pdev,
sizeof(*ringacc->rings) *
ringacc->num_rings,
GFP_KERNEL);
ringacc->rings_inuse = devm_kcalloc(dev,
BITS_TO_LONGS(ringacc->num_rings),
sizeof(unsigned long), GFP_KERNEL);
ringacc->proxy_inuse = devm_kcalloc(dev,
BITS_TO_LONGS(ringacc->num_proxies),
sizeof(unsigned long), GFP_KERNEL);
ringacc->rings_inuse = devm_bitmap_zalloc(dev, ringacc->num_rings,
GFP_KERNEL);
ringacc->proxy_inuse = devm_bitmap_zalloc(dev, ringacc->num_proxies,
GFP_KERNEL);

if (!ringacc->rings || !ringacc->rings_inuse || !ringacc->proxy_inuse)
return -ENOMEM;
Expand Down Expand Up @@ -1483,9 +1481,8 @@ struct k3_ringacc *k3_ringacc_dmarings_init(struct platform_device *pdev,
sizeof(*ringacc->rings) *
ringacc->num_rings * 2,
GFP_KERNEL);
ringacc->rings_inuse = devm_kcalloc(dev,
BITS_TO_LONGS(ringacc->num_rings),
sizeof(unsigned long), GFP_KERNEL);
ringacc->rings_inuse = devm_bitmap_zalloc(dev, ringacc->num_rings,
GFP_KERNEL);

if (!ringacc->rings || !ringacc->rings_inuse)
return ERR_PTR(-ENOMEM);
Expand Down

0 comments on commit a8eba8d

Please sign in to comment.