Skip to contentSkip to conversation

iommu/amd: Remove unnecessary assignment

PATCH RESEND In review Adrian Huang 3 participants 3 messages Dec 10, 2020 – Jan 27, 2021

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

PATCH RESEND 1/1 iommu/amd: Remove unnecessary assignment

From: Adrian Huang <[email protected]>

From: Adrian Huang <[email protected]>

The values of local variables are assigned after local variables are declared, so no need to assign the initial value during the variable declaration.

And, no need to assign NULL for the local variable 'ivrs_base' after invoking acpi_put_table().

---
 drivers/iommu/amd/init.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/iommu/amd/init.c +2 -3
index 23a790f8f550..103cbf8fc2d9 100644
@@ -1916,7 +1916,7 @@ static void print_iommu_info(void)
 static int __init amd_iommu_init_pci(void)
 {
 	struct amd_iommu *iommu;
-	int ret = 0;
+	int ret;
 
 	for_each_iommu(iommu) {
 		ret = iommu_init_pci(iommu);
@@ -2555,8 +2555,8 @@ static void __init free_dma_resources(void)
 static int __init early_amd_iommu_init(void)
 {
 	struct acpi_table_header *ivrs_base;
+	int i, remap_cache_sz, ret;
 	acpi_status status;
-	int i, remap_cache_sz, ret = 0;
 	u32 pci_id;
 
 	if (!amd_iommu_detected)
@@ -2698,7 +2698,6 @@ static int __init early_amd_iommu_init(void)
 out:
 	/* Don't leak any ACPI memory */
 	acpi_put_table(ivrs_base);
-	ivrs_base = NULL;
 
 	return ret;
 }
Signature · 6 lines
2.17.1

_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 8 lines · Adrian Huang

From: Adrian Huang <[email protected]>

From: Adrian Huang <[email protected]>

The values of local variables are assigned after local variables are declared, so no need to assign the initial value during the variable declaration.

Quoted 7 lines

And, no need to assign NULL for the local variable 'ivrs_base' after invoking acpi_put_table().

---
 drivers/iommu/amd/init.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

Will
_______________________________________________
iommu mailing list
[email protected]
https://lists.linuxfoundation.org/mailman/listinfo/iommu