Skip to contentSkip to conversation

iommu/vt-d: remove redundant assignment to variable err

PATCH In review Colin Ian King 2 participants 2 messages Apr 11, 2024 – Apr 24, 2024

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iommu/vt-d: remove redundant assignment to variable err

Variable err is being assigned a value that is never read. It is either being re-assigned later on error exit paths, or never referenced on the non-error path.

Cleans up clang scan build warning:
drivers/iommu/intel/dmar.c:1070:2: warning: Value stored to 'err' is never read [deadcode.DeadStores]`

---
 drivers/iommu/intel/dmar.c | 1 -
 1 file changed, 1 deletion(-)
drivers/iommu/intel/dmar.c +0 -1
index 36d7427b1202..351be9455214 100644
@@ -1067,7 +1067,6 @@ static int alloc_iommu(struct dmar_drhd_unit *drhd)
 		goto error_free_seq_id;
 	}
 
-	err = -EINVAL;
 	if (!cap_sagaw(iommu->cap) &&
 	    (!ecap_smts(iommu->ecap) || ecap_slts(iommu->ecap))) {
 		pr_info("%s: No supported address widths. Not attempting DMA translation.\n",
Signature · 1 line
2.39.2
maintainer
#1 lore raw
Quoted 4 lines · Colin Ian King

Variable err is being assigned a value that is never read. It is either being re-assigned later on error exit paths, or never referenced on the non-error path.

Quoted 8 lines

Cleans up clang scan build warning:
drivers/iommu/intel/dmar.c:1070:2: warning: Value stored to 'err' is never read [deadcode.DeadStores]`

---
  drivers/iommu/intel/dmar.c | 1 -
  1 file changed, 1 deletion(-)

Patch has been queued for iommu/vt-d.

Best regards,
baolu