File tree Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -1878,17 +1878,16 @@ static void iommu_disable_translation(struct intel_iommu *iommu)
1878
1878
1879
1879
static int iommu_init_domains (struct intel_iommu * iommu )
1880
1880
{
1881
- u32 ndomains , nlongs ;
1881
+ u32 ndomains ;
1882
1882
size_t size ;
1883
1883
1884
1884
ndomains = cap_ndoms (iommu -> cap );
1885
1885
pr_debug ("%s: Number of Domains supported <%d>\n" ,
1886
1886
iommu -> name , ndomains );
1887
- nlongs = BITS_TO_LONGS (ndomains );
1888
1887
1889
1888
spin_lock_init (& iommu -> lock );
1890
1889
1891
- iommu -> domain_ids = kcalloc ( nlongs , sizeof ( unsigned long ) , GFP_KERNEL );
1890
+ iommu -> domain_ids = bitmap_zalloc ( ndomains , GFP_KERNEL );
1892
1891
if (!iommu -> domain_ids )
1893
1892
return - ENOMEM ;
1894
1893
@@ -1903,7 +1902,7 @@ static int iommu_init_domains(struct intel_iommu *iommu)
1903
1902
if (!iommu -> domains || !iommu -> domains [0 ]) {
1904
1903
pr_err ("%s: Allocating domain array failed\n" ,
1905
1904
iommu -> name );
1906
- kfree (iommu -> domain_ids );
1905
+ bitmap_free (iommu -> domain_ids );
1907
1906
kfree (iommu -> domains );
1908
1907
iommu -> domain_ids = NULL ;
1909
1908
iommu -> domains = NULL ;
@@ -1964,7 +1963,7 @@ static void free_dmar_iommu(struct intel_iommu *iommu)
1964
1963
for (i = 0 ; i < elems ; i ++ )
1965
1964
kfree (iommu -> domains [i ]);
1966
1965
kfree (iommu -> domains );
1967
- kfree (iommu -> domain_ids );
1966
+ bitmap_free (iommu -> domain_ids );
1968
1967
iommu -> domains = NULL ;
1969
1968
iommu -> domain_ids = NULL ;
1970
1969
}
You can’t perform that action at this time.
0 commit comments