Skip to contentSkip to conversation

iommu: remove redundant assignment to variable agaw

PATCH Applied Colin King 2 participants 2 messages Apr 16, 2021 – Jun 9, 2021

Subsystems (3)
lore
Share & tools
lore

Colin King

author
#0 lore raw

PATCH 1/1 iommu: remove redundant assignment to variable agaw

From: Colin Ian King <[email protected]>

The variable agaw is initialized with a value that is never read and it is being updated later with a new value as a counter in a for-loop. The initialization is redundant and can be removed.

Addresses-Coverity: ("Unused value")

---
 drivers/iommu/intel/iommu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iommu/intel/iommu.c +1 -1
index 0e04d450c38a..171dd4844ab2 100644
@@ -564,7 +564,7 @@ static inline int domain_pfn_supported(struct dmar_domain *domain,
 static int __iommu_calculate_agaw(struct intel_iommu *iommu, int max_gaw)
 {
 	unsigned long sagaw;
-	int agaw = -1;
+	int agaw;
 
 	sagaw = cap_sagaw(iommu->cap);
 	for (agaw = width_to_agaw(max_gaw);
Signature · 6 lines
2.30.2

_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu
maintainer Applied
#1 lore raw
Quoted 9 lines · Colin King

From: Colin Ian King<[email protected]>

The variable agaw is initialized with a value that is never read and it is being updated later with a new value as a counter in a for-loop. The initialization is redundant and can be removed.

Addresses-Coverity: ("Unused value")

Queued for v5.14. Thanks!

Best regards,
baolu