Skip to contentSkip to conversation

iommu/sun50i: Fix compile warnings

PATCH New Joerg Roedel 1 participant 2 messages May 14, 2020

Subsystems (2)
lore
Share & tools
lore

Joerg Roedel

author maintainer
#0 lore raw

PATCH 1/2 iommu/sun50i: Fix compile warnings

From: Joerg Roedel <[email protected]>

A few compile warnings show up when building this driver:

CC drivers/iommu/sun50i-iommu.o
drivers/iommu/sun50i-iommu.c: In function ‘sun50i_dte_get_page_table’:
drivers/iommu/sun50i-iommu.c:486:16: warning: unused variable ‘flags’ [-Wunused-variable]

  486 |  unsigned long flags;
      |                ^~~~~

drivers/iommu/sun50i-iommu.c: In function ‘sun50i_iommu_unmap’:
drivers/iommu/sun50i-iommu.c:559:23: warning: unused variable ‘iommu’ [-Wunused-variable]
559 | struct sun50i_iommu *iommu = sun50i_domain->iommu;
| ^~~~~
drivers/iommu/sun50i-iommu.c: In function ‘sun50i_iommu_probe_device’:
drivers/iommu/sun50i-iommu.c:749:22: warning: unused variable ‘group’ [-Wunused-variable]
749 | struct iommu_group *group;
| ^~~~~

Remove the unused variables.

---
 drivers/iommu/sun50i-iommu.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/iommu/sun50i-iommu.c +0 -3
index 989d87aa4426..a52f52eff7c8 100644
@@ -483,7 +483,6 @@ static u32 *sun50i_dte_get_page_table(struct sun50i_iommu_domain *sun50i_domain,
 				      dma_addr_t iova, gfp_t gfp)
 {
 	struct sun50i_iommu *iommu = sun50i_domain->iommu;
-	unsigned long flags;
 	u32 *page_table;
 	u32 *dte_addr;
 	u32 old_dte;
@@ -556,7 +555,6 @@ static size_t sun50i_iommu_unmap(struct iommu_domain *domain, unsigned long iova
 				 size_t size, struct iommu_iotlb_gather *gather)
 {
 	struct sun50i_iommu_domain *sun50i_domain = to_sun50i_domain(domain);
-	struct sun50i_iommu *iommu = sun50i_domain->iommu;
 	phys_addr_t pt_phys;
 	dma_addr_t pte_dma;
 	u32 *pte_addr;
@@ -746,7 +744,6 @@ static int sun50i_iommu_attach_device(struct iommu_domain *domain,
 static struct iommu_device *sun50i_iommu_probe_device(struct device *dev)
 {
 	struct sun50i_iommu *iommu;
-	struct iommu_group *group;
 
 	iommu = sun50i_iommu_from_dev(dev);
 	if (!iommu)
Signature · 6 lines
2.17.1

_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu
author maintainer
#1 lore raw

PATCH 2/2 iommu/sun50i: Use __GFP_ZERO instead of memset()

From: Joerg Roedel <[email protected]>

Allocate zeroed memory so there is no need to memset it to 0 in the driver.

---
 drivers/iommu/sun50i-iommu.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/iommu/sun50i-iommu.c +1 -2
index a52f52eff7c8..9c763d4a8e2a 100644
@@ -616,11 +616,10 @@ static struct iommu_domain *sun50i_iommu_domain_alloc(unsigned type)
 	    iommu_get_dma_cookie(&sun50i_domain->domain))
 		goto err_free_domain;
 
-	sun50i_domain->dt = (u32 *)__get_free_pages(GFP_KERNEL,
+	sun50i_domain->dt = (u32 *)__get_free_pages(GFP_KERNEL | __GFP_ZERO,
 						    get_order(DT_SIZE));
 	if (!sun50i_domain->dt)
 		goto err_put_cookie;
-	memset(sun50i_domain->dt, 0, DT_SIZE);
 
 	refcount_set(&sun50i_domain->refcnt, 1);
 
Signature · 1 line
2.17.1