All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] iommu/vt-d: Use bitmap_zalloc() when applicable
@ 2021-12-17 21:58 ` Christophe JAILLET
  0 siblings, 0 replies; 8+ messages in thread
From: Christophe JAILLET @ 2021-12-17 21:58 UTC (permalink / raw)
  To: dwmw2, baolu.lu, joro, will
  Cc: iommu, linux-kernel, kernel-janitors, Christophe JAILLET

'ommu->domain_ids' is a bitmap. So use 'bitmap_zalloc()' to simplify
code and improve the semantic, instead of hand writing it.

Also change the corresponding 'kfree()' into 'bitmap_free()' to keep
consistency.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/iommu/intel/iommu.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c
index b6a8f3282411..4acc97765209 100644
--- a/drivers/iommu/intel/iommu.c
+++ b/drivers/iommu/intel/iommu.c
@@ -1878,17 +1878,16 @@ static void iommu_disable_translation(struct intel_iommu *iommu)
 
 static int iommu_init_domains(struct intel_iommu *iommu)
 {
-	u32 ndomains, nlongs;
+	u32 ndomains;
 	size_t size;
 
 	ndomains = cap_ndoms(iommu->cap);
 	pr_debug("%s: Number of Domains supported <%d>\n",
 		 iommu->name, ndomains);
-	nlongs = BITS_TO_LONGS(ndomains);
 
 	spin_lock_init(&iommu->lock);
 
-	iommu->domain_ids = kcalloc(nlongs, sizeof(unsigned long), GFP_KERNEL);
+	iommu->domain_ids = bitmap_zalloc(ndomains, GFP_KERNEL);
 	if (!iommu->domain_ids)
 		return -ENOMEM;
 
@@ -1903,7 +1902,7 @@ static int iommu_init_domains(struct intel_iommu *iommu)
 	if (!iommu->domains || !iommu->domains[0]) {
 		pr_err("%s: Allocating domain array failed\n",
 		       iommu->name);
-		kfree(iommu->domain_ids);
+		bitmap_free(iommu->domain_ids);
 		kfree(iommu->domains);
 		iommu->domain_ids = NULL;
 		iommu->domains    = NULL;
@@ -1964,7 +1963,7 @@ static void free_dmar_iommu(struct intel_iommu *iommu)
 		for (i = 0; i < elems; i++)
 			kfree(iommu->domains[i]);
 		kfree(iommu->domains);
-		kfree(iommu->domain_ids);
+		bitmap_free(iommu->domain_ids);
 		iommu->domains = NULL;
 		iommu->domain_ids = NULL;
 	}
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH] iommu/vt-d: Use bitmap_zalloc() when applicable
@ 2021-12-17 21:58 ` Christophe JAILLET
  0 siblings, 0 replies; 8+ messages in thread
From: Christophe JAILLET @ 2021-12-17 21:58 UTC (permalink / raw)
  To: dwmw2, baolu.lu, joro, will
  Cc: Christophe JAILLET, iommu, kernel-janitors, linux-kernel

'ommu->domain_ids' is a bitmap. So use 'bitmap_zalloc()' to simplify
code and improve the semantic, instead of hand writing it.

Also change the corresponding 'kfree()' into 'bitmap_free()' to keep
consistency.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/iommu/intel/iommu.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c
index b6a8f3282411..4acc97765209 100644
--- a/drivers/iommu/intel/iommu.c
+++ b/drivers/iommu/intel/iommu.c
@@ -1878,17 +1878,16 @@ static void iommu_disable_translation(struct intel_iommu *iommu)
 
 static int iommu_init_domains(struct intel_iommu *iommu)
 {
-	u32 ndomains, nlongs;
+	u32 ndomains;
 	size_t size;
 
 	ndomains = cap_ndoms(iommu->cap);
 	pr_debug("%s: Number of Domains supported <%d>\n",
 		 iommu->name, ndomains);
-	nlongs = BITS_TO_LONGS(ndomains);
 
 	spin_lock_init(&iommu->lock);
 
-	iommu->domain_ids = kcalloc(nlongs, sizeof(unsigned long), GFP_KERNEL);
+	iommu->domain_ids = bitmap_zalloc(ndomains, GFP_KERNEL);
 	if (!iommu->domain_ids)
 		return -ENOMEM;
 
@@ -1903,7 +1902,7 @@ static int iommu_init_domains(struct intel_iommu *iommu)
 	if (!iommu->domains || !iommu->domains[0]) {
 		pr_err("%s: Allocating domain array failed\n",
 		       iommu->name);
-		kfree(iommu->domain_ids);
+		bitmap_free(iommu->domain_ids);
 		kfree(iommu->domains);
 		iommu->domain_ids = NULL;
 		iommu->domains    = NULL;
@@ -1964,7 +1963,7 @@ static void free_dmar_iommu(struct intel_iommu *iommu)
 		for (i = 0; i < elems; i++)
 			kfree(iommu->domains[i]);
 		kfree(iommu->domains);
-		kfree(iommu->domain_ids);
+		bitmap_free(iommu->domain_ids);
 		iommu->domains = NULL;
 		iommu->domain_ids = NULL;
 	}
-- 
2.30.2

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] iommu/vt-d: Use bitmap_zalloc() when applicable
  2021-12-17 21:58 ` Christophe JAILLET
@ 2021-12-18  5:56   ` Lu Baolu
  -1 siblings, 0 replies; 8+ messages in thread
From: Lu Baolu @ 2021-12-18  5:56 UTC (permalink / raw)
  To: Christophe JAILLET, dwmw2, joro, will
  Cc: baolu.lu, iommu, linux-kernel, kernel-janitors

On 2021/12/18 5:58, Christophe JAILLET wrote:
> 'ommu->domain_ids' is a bitmap. So use 'bitmap_zalloc()' to simplify
> code and improve the semantic, instead of hand writing it.
> 
> Also change the corresponding 'kfree()' into 'bitmap_free()' to keep
> consistency.
> 
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
>   drivers/iommu/intel/iommu.c | 9 ++++-----
>   1 file changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c
> index b6a8f3282411..4acc97765209 100644
> --- a/drivers/iommu/intel/iommu.c
> +++ b/drivers/iommu/intel/iommu.c
> @@ -1878,17 +1878,16 @@ static void iommu_disable_translation(struct intel_iommu *iommu)
>   
>   static int iommu_init_domains(struct intel_iommu *iommu)
>   {
> -	u32 ndomains, nlongs;
> +	u32 ndomains;
>   	size_t size;
>   
>   	ndomains = cap_ndoms(iommu->cap);
>   	pr_debug("%s: Number of Domains supported <%d>\n",
>   		 iommu->name, ndomains);
> -	nlongs = BITS_TO_LONGS(ndomains);
>   
>   	spin_lock_init(&iommu->lock);
>   
> -	iommu->domain_ids = kcalloc(nlongs, sizeof(unsigned long), GFP_KERNEL);
> +	iommu->domain_ids = bitmap_zalloc(ndomains, GFP_KERNEL);
>   	if (!iommu->domain_ids)
>   		return -ENOMEM;
>   
> @@ -1903,7 +1902,7 @@ static int iommu_init_domains(struct intel_iommu *iommu)
>   	if (!iommu->domains || !iommu->domains[0]) {
>   		pr_err("%s: Allocating domain array failed\n",
>   		       iommu->name);
> -		kfree(iommu->domain_ids);
> +		bitmap_free(iommu->domain_ids);
>   		kfree(iommu->domains);
>   		iommu->domain_ids = NULL;
>   		iommu->domains    = NULL;
> @@ -1964,7 +1963,7 @@ static void free_dmar_iommu(struct intel_iommu *iommu)
>   		for (i = 0; i < elems; i++)
>   			kfree(iommu->domains[i]);
>   		kfree(iommu->domains);
> -		kfree(iommu->domain_ids);
> +		bitmap_free(iommu->domain_ids);
>   		iommu->domains = NULL;
>   		iommu->domain_ids = NULL;
>   	}

This patch has been merged to Joerg's tree through

https://lore.kernel.org/linux-iommu/20211217083817.1745419-2-baolu.lu@linux.intel.com/

Are there any extra changes in this one?

Best regards,
baolu

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] iommu/vt-d: Use bitmap_zalloc() when applicable
@ 2021-12-18  5:56   ` Lu Baolu
  0 siblings, 0 replies; 8+ messages in thread
From: Lu Baolu @ 2021-12-18  5:56 UTC (permalink / raw)
  To: Christophe JAILLET, dwmw2, joro, will
  Cc: iommu, kernel-janitors, linux-kernel

On 2021/12/18 5:58, Christophe JAILLET wrote:
> 'ommu->domain_ids' is a bitmap. So use 'bitmap_zalloc()' to simplify
> code and improve the semantic, instead of hand writing it.
> 
> Also change the corresponding 'kfree()' into 'bitmap_free()' to keep
> consistency.
> 
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
>   drivers/iommu/intel/iommu.c | 9 ++++-----
>   1 file changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c
> index b6a8f3282411..4acc97765209 100644
> --- a/drivers/iommu/intel/iommu.c
> +++ b/drivers/iommu/intel/iommu.c
> @@ -1878,17 +1878,16 @@ static void iommu_disable_translation(struct intel_iommu *iommu)
>   
>   static int iommu_init_domains(struct intel_iommu *iommu)
>   {
> -	u32 ndomains, nlongs;
> +	u32 ndomains;
>   	size_t size;
>   
>   	ndomains = cap_ndoms(iommu->cap);
>   	pr_debug("%s: Number of Domains supported <%d>\n",
>   		 iommu->name, ndomains);
> -	nlongs = BITS_TO_LONGS(ndomains);
>   
>   	spin_lock_init(&iommu->lock);
>   
> -	iommu->domain_ids = kcalloc(nlongs, sizeof(unsigned long), GFP_KERNEL);
> +	iommu->domain_ids = bitmap_zalloc(ndomains, GFP_KERNEL);
>   	if (!iommu->domain_ids)
>   		return -ENOMEM;
>   
> @@ -1903,7 +1902,7 @@ static int iommu_init_domains(struct intel_iommu *iommu)
>   	if (!iommu->domains || !iommu->domains[0]) {
>   		pr_err("%s: Allocating domain array failed\n",
>   		       iommu->name);
> -		kfree(iommu->domain_ids);
> +		bitmap_free(iommu->domain_ids);
>   		kfree(iommu->domains);
>   		iommu->domain_ids = NULL;
>   		iommu->domains    = NULL;
> @@ -1964,7 +1963,7 @@ static void free_dmar_iommu(struct intel_iommu *iommu)
>   		for (i = 0; i < elems; i++)
>   			kfree(iommu->domains[i]);
>   		kfree(iommu->domains);
> -		kfree(iommu->domain_ids);
> +		bitmap_free(iommu->domain_ids);
>   		iommu->domains = NULL;
>   		iommu->domain_ids = NULL;
>   	}

This patch has been merged to Joerg's tree through

https://lore.kernel.org/linux-iommu/20211217083817.1745419-2-baolu.lu@linux.intel.com/

Are there any extra changes in this one?

Best regards,
baolu
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] iommu/vt-d: Use bitmap_zalloc() when applicable
  2021-12-18  5:56   ` Lu Baolu
@ 2021-12-18  6:55     ` Christophe JAILLET
  -1 siblings, 0 replies; 8+ messages in thread
From: Christophe JAILLET @ 2021-12-18  6:55 UTC (permalink / raw)
  To: Lu Baolu, dwmw2, joro, will; +Cc: iommu, linux-kernel, kernel-janitors

Le 18/12/2021 à 06:56, Lu Baolu a écrit :
> On 2021/12/18 5:58, Christophe JAILLET wrote:
>> 'ommu->domain_ids' is a bitmap. So use 'bitmap_zalloc()' to simplify
>> code and improve the semantic, instead of hand writing it.
>>
>> Also change the corresponding 'kfree()' into 'bitmap_free()' to keep
>> consistency.
>>
>> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
>> ---
>>   drivers/iommu/intel/iommu.c | 9 ++++-----
>>   1 file changed, 4 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c
>> index b6a8f3282411..4acc97765209 100644
>> --- a/drivers/iommu/intel/iommu.c
>> +++ b/drivers/iommu/intel/iommu.c
>> @@ -1878,17 +1878,16 @@ static void iommu_disable_translation(struct 
>> intel_iommu *iommu)
>>   static int iommu_init_domains(struct intel_iommu *iommu)
>>   {
>> -    u32 ndomains, nlongs;
>> +    u32 ndomains;
>>       size_t size;
>>       ndomains = cap_ndoms(iommu->cap);
>>       pr_debug("%s: Number of Domains supported <%d>\n",
>>            iommu->name, ndomains);
>> -    nlongs = BITS_TO_LONGS(ndomains);
>>       spin_lock_init(&iommu->lock);
>> -    iommu->domain_ids = kcalloc(nlongs, sizeof(unsigned long), 
>> GFP_KERNEL);
>> +    iommu->domain_ids = bitmap_zalloc(ndomains, GFP_KERNEL);
>>       if (!iommu->domain_ids)
>>           return -ENOMEM;
>> @@ -1903,7 +1902,7 @@ static int iommu_init_domains(struct intel_iommu 
>> *iommu)
>>       if (!iommu->domains || !iommu->domains[0]) {
>>           pr_err("%s: Allocating domain array failed\n",
>>                  iommu->name);
>> -        kfree(iommu->domain_ids);
>> +        bitmap_free(iommu->domain_ids);
>>           kfree(iommu->domains);
>>           iommu->domain_ids = NULL;
>>           iommu->domains    = NULL;
>> @@ -1964,7 +1963,7 @@ static void free_dmar_iommu(struct intel_iommu 
>> *iommu)
>>           for (i = 0; i < elems; i++)
>>               kfree(iommu->domains[i]);
>>           kfree(iommu->domains);
>> -        kfree(iommu->domain_ids);
>> +        bitmap_free(iommu->domain_ids);
>>           iommu->domains = NULL;
>>           iommu->domain_ids = NULL;
>>       }
> 
> This patch has been merged to Joerg's tree through
> 
> https://lore.kernel.org/linux-iommu/20211217083817.1745419-2-baolu.lu@linux.intel.com/ 
> 
> 
> Are there any extra changes in this one?

No, this is the same. Sorry for the duplicate.

CJ

> 
> Best regards,
> baolu
> 


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] iommu/vt-d: Use bitmap_zalloc() when applicable
@ 2021-12-18  6:55     ` Christophe JAILLET
  0 siblings, 0 replies; 8+ messages in thread
From: Christophe JAILLET @ 2021-12-18  6:55 UTC (permalink / raw)
  To: Lu Baolu, dwmw2, joro, will; +Cc: iommu, kernel-janitors, linux-kernel

Le 18/12/2021 à 06:56, Lu Baolu a écrit :
> On 2021/12/18 5:58, Christophe JAILLET wrote:
>> 'ommu->domain_ids' is a bitmap. So use 'bitmap_zalloc()' to simplify
>> code and improve the semantic, instead of hand writing it.
>>
>> Also change the corresponding 'kfree()' into 'bitmap_free()' to keep
>> consistency.
>>
>> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
>> ---
>>   drivers/iommu/intel/iommu.c | 9 ++++-----
>>   1 file changed, 4 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c
>> index b6a8f3282411..4acc97765209 100644
>> --- a/drivers/iommu/intel/iommu.c
>> +++ b/drivers/iommu/intel/iommu.c
>> @@ -1878,17 +1878,16 @@ static void iommu_disable_translation(struct 
>> intel_iommu *iommu)
>>   static int iommu_init_domains(struct intel_iommu *iommu)
>>   {
>> -    u32 ndomains, nlongs;
>> +    u32 ndomains;
>>       size_t size;
>>       ndomains = cap_ndoms(iommu->cap);
>>       pr_debug("%s: Number of Domains supported <%d>\n",
>>            iommu->name, ndomains);
>> -    nlongs = BITS_TO_LONGS(ndomains);
>>       spin_lock_init(&iommu->lock);
>> -    iommu->domain_ids = kcalloc(nlongs, sizeof(unsigned long), 
>> GFP_KERNEL);
>> +    iommu->domain_ids = bitmap_zalloc(ndomains, GFP_KERNEL);
>>       if (!iommu->domain_ids)
>>           return -ENOMEM;
>> @@ -1903,7 +1902,7 @@ static int iommu_init_domains(struct intel_iommu 
>> *iommu)
>>       if (!iommu->domains || !iommu->domains[0]) {
>>           pr_err("%s: Allocating domain array failed\n",
>>                  iommu->name);
>> -        kfree(iommu->domain_ids);
>> +        bitmap_free(iommu->domain_ids);
>>           kfree(iommu->domains);
>>           iommu->domain_ids = NULL;
>>           iommu->domains    = NULL;
>> @@ -1964,7 +1963,7 @@ static void free_dmar_iommu(struct intel_iommu 
>> *iommu)
>>           for (i = 0; i < elems; i++)
>>               kfree(iommu->domains[i]);
>>           kfree(iommu->domains);
>> -        kfree(iommu->domain_ids);
>> +        bitmap_free(iommu->domain_ids);
>>           iommu->domains = NULL;
>>           iommu->domain_ids = NULL;
>>       }
> 
> This patch has been merged to Joerg's tree through
> 
> https://lore.kernel.org/linux-iommu/20211217083817.1745419-2-baolu.lu@linux.intel.com/ 
> 
> 
> Are there any extra changes in this one?

No, this is the same. Sorry for the duplicate.

CJ

> 
> Best regards,
> baolu
> 

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH] iommu/vt-d: Use bitmap_zalloc() when applicable
@ 2021-10-23 19:49 ` Christophe JAILLET
  0 siblings, 0 replies; 8+ messages in thread
From: Christophe JAILLET @ 2021-10-23 19:49 UTC (permalink / raw)
  To: dwmw2, baolu.lu, joro, will
  Cc: iommu, linux-kernel, kernel-janitors, Christophe JAILLET

'iommu->domain_ids' is a bitmap. So use 'bitmap_zalloc()' to simplify code
and improve the semantic.

Also change the corresponding 'kfree()' into 'bitmap_free()' to keep
consistency.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/iommu/intel/iommu.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c
index 0bde0c8b4126..2ae75b7f7dec 100644
--- a/drivers/iommu/intel/iommu.c
+++ b/drivers/iommu/intel/iommu.c
@@ -1880,17 +1880,16 @@ static void iommu_disable_translation(struct intel_iommu *iommu)
 
 static int iommu_init_domains(struct intel_iommu *iommu)
 {
-	u32 ndomains, nlongs;
+	u32 ndomains;
 	size_t size;
 
 	ndomains = cap_ndoms(iommu->cap);
 	pr_debug("%s: Number of Domains supported <%d>\n",
 		 iommu->name, ndomains);
-	nlongs = BITS_TO_LONGS(ndomains);
 
 	spin_lock_init(&iommu->lock);
 
-	iommu->domain_ids = kcalloc(nlongs, sizeof(unsigned long), GFP_KERNEL);
+	iommu->domain_ids = bitmap_zalloc(ndomains, GFP_KERNEL);
 	if (!iommu->domain_ids)
 		return -ENOMEM;
 
@@ -1905,7 +1904,7 @@ static int iommu_init_domains(struct intel_iommu *iommu)
 	if (!iommu->domains || !iommu->domains[0]) {
 		pr_err("%s: Allocating domain array failed\n",
 		       iommu->name);
-		kfree(iommu->domain_ids);
+		bitmap_free(iommu->domain_ids);
 		kfree(iommu->domains);
 		iommu->domain_ids = NULL;
 		iommu->domains    = NULL;
@@ -1966,7 +1965,7 @@ static void free_dmar_iommu(struct intel_iommu *iommu)
 		for (i = 0; i < elems; i++)
 			kfree(iommu->domains[i]);
 		kfree(iommu->domains);
-		kfree(iommu->domain_ids);
+		bitmap_free(iommu->domain_ids);
 		iommu->domains = NULL;
 		iommu->domain_ids = NULL;
 	}
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH] iommu/vt-d: Use bitmap_zalloc() when applicable
@ 2021-10-23 19:49 ` Christophe JAILLET
  0 siblings, 0 replies; 8+ messages in thread
From: Christophe JAILLET @ 2021-10-23 19:49 UTC (permalink / raw)
  To: dwmw2, baolu.lu, joro, will
  Cc: Christophe JAILLET, iommu, kernel-janitors, linux-kernel

'iommu->domain_ids' is a bitmap. So use 'bitmap_zalloc()' to simplify code
and improve the semantic.

Also change the corresponding 'kfree()' into 'bitmap_free()' to keep
consistency.

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
 drivers/iommu/intel/iommu.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c
index 0bde0c8b4126..2ae75b7f7dec 100644
--- a/drivers/iommu/intel/iommu.c
+++ b/drivers/iommu/intel/iommu.c
@@ -1880,17 +1880,16 @@ static void iommu_disable_translation(struct intel_iommu *iommu)
 
 static int iommu_init_domains(struct intel_iommu *iommu)
 {
-	u32 ndomains, nlongs;
+	u32 ndomains;
 	size_t size;
 
 	ndomains = cap_ndoms(iommu->cap);
 	pr_debug("%s: Number of Domains supported <%d>\n",
 		 iommu->name, ndomains);
-	nlongs = BITS_TO_LONGS(ndomains);
 
 	spin_lock_init(&iommu->lock);
 
-	iommu->domain_ids = kcalloc(nlongs, sizeof(unsigned long), GFP_KERNEL);
+	iommu->domain_ids = bitmap_zalloc(ndomains, GFP_KERNEL);
 	if (!iommu->domain_ids)
 		return -ENOMEM;
 
@@ -1905,7 +1904,7 @@ static int iommu_init_domains(struct intel_iommu *iommu)
 	if (!iommu->domains || !iommu->domains[0]) {
 		pr_err("%s: Allocating domain array failed\n",
 		       iommu->name);
-		kfree(iommu->domain_ids);
+		bitmap_free(iommu->domain_ids);
 		kfree(iommu->domains);
 		iommu->domain_ids = NULL;
 		iommu->domains    = NULL;
@@ -1966,7 +1965,7 @@ static void free_dmar_iommu(struct intel_iommu *iommu)
 		for (i = 0; i < elems; i++)
 			kfree(iommu->domains[i]);
 		kfree(iommu->domains);
-		kfree(iommu->domain_ids);
+		bitmap_free(iommu->domain_ids);
 		iommu->domains = NULL;
 		iommu->domain_ids = NULL;
 	}
-- 
2.30.2

_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-12-18  6:55 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-17 21:58 [PATCH] iommu/vt-d: Use bitmap_zalloc() when applicable Christophe JAILLET
2021-12-17 21:58 ` Christophe JAILLET
2021-12-18  5:56 ` Lu Baolu
2021-12-18  5:56   ` Lu Baolu
2021-12-18  6:55   ` Christophe JAILLET
2021-12-18  6:55     ` Christophe JAILLET
  -- strict thread matches above, loose matches on Subject: below --
2021-10-23 19:49 Christophe JAILLET
2021-10-23 19:49 ` Christophe JAILLET

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.