Skip to content

Commit 8937424

Browse files
tititiou36joergroedel
authored andcommitted
iommu/tegra-smmu: Use devm_bitmap_zalloc when applicable
'smmu->asids' is a bitmap. So use 'devm_kzalloc()' to simplify code, improve the semantic of the code and avoid some open-coded arithmetic in allocator arguments. Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Acked-by: Thierry Reding <treding@nvidia.com> Link: https://lore.kernel.org/r/2c0f4da80c3b5ef83299c651f69a563034c1c6cb.1632661557.git.christophe.jaillet@wanadoo.fr Signed-off-by: Joerg Roedel <jroedel@suse.de>
1 parent 5816b3e commit 8937424

1 file changed

Lines changed: 1 addition & 4 deletions

File tree

drivers/iommu/tegra-smmu.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1079,7 +1079,6 @@ struct tegra_smmu *tegra_smmu_probe(struct device *dev,
10791079
struct tegra_mc *mc)
10801080
{
10811081
struct tegra_smmu *smmu;
1082-
size_t size;
10831082
u32 value;
10841083
int err;
10851084

@@ -1097,9 +1096,7 @@ struct tegra_smmu *tegra_smmu_probe(struct device *dev,
10971096
*/
10981097
mc->smmu = smmu;
10991098

1100-
size = BITS_TO_LONGS(soc->num_asids) * sizeof(long);
1101-
1102-
smmu->asids = devm_kzalloc(dev, size, GFP_KERNEL);
1099+
smmu->asids = devm_bitmap_zalloc(dev, soc->num_asids, GFP_KERNEL);
11031100
if (!smmu->asids)
11041101
return ERR_PTR(-ENOMEM);
11051102

0 commit comments

Comments
 (0)