]> Git Repo - J-linux.git/commitdiff
iommu/tegra-smmu: Use devm_bitmap_zalloc when applicable
authorChristophe JAILLET <[email protected]>
Sun, 26 Sep 2021 13:07:18 +0000 (15:07 +0200)
committerJoerg Roedel <[email protected]>
Mon, 18 Oct 2021 11:39:41 +0000 (13:39 +0200)
'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 <[email protected]>
Acked-by: Thierry Reding <[email protected]>
Link: https://lore.kernel.org/r/2c0f4da80c3b5ef83299c651f69a563034c1c6cb.1632661557.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Joerg Roedel <[email protected]>
drivers/iommu/tegra-smmu.c

index 0a281833f6117b459add16afb10c25cd216fdb70..e900e3c46903b1b909d07ae7000b3cad99f0326f 100644 (file)
@@ -1079,7 +1079,6 @@ struct tegra_smmu *tegra_smmu_probe(struct device *dev,
                                    struct tegra_mc *mc)
 {
        struct tegra_smmu *smmu;
-       size_t size;
        u32 value;
        int err;
 
@@ -1097,9 +1096,7 @@ struct tegra_smmu *tegra_smmu_probe(struct device *dev,
         */
        mc->smmu = smmu;
 
-       size = BITS_TO_LONGS(soc->num_asids) * sizeof(long);
-
-       smmu->asids = devm_kzalloc(dev, size, GFP_KERNEL);
+       smmu->asids = devm_bitmap_zalloc(dev, soc->num_asids, GFP_KERNEL);
        if (!smmu->asids)
                return ERR_PTR(-ENOMEM);
 
This page took 0.056563 seconds and 4 git commands to generate.