[PATCH] x86/PCI: Remove unused assignment to variable info

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The value returned from the alloc_pci_root_info() function that is
assigned to the "info" variable within the loop body is never used for
anything once the loop finishes its run, and it is overridden later
within another loop body where the value returned from the
find_pci_root_info() will be assigned to it.

When the function alloc_pci_root_info() is executed within the body of
the first loop, it would allocate a new struct pci_root_info and then
store pointer to it in a global linked list called "pci_root_infos",
thus the value that the "info" variable would contain after the loop
finishes would reference the struct pci_root_info that was allocated the
last, thus it might not necessarily be of use.

Additionally, the function find_pci_root_info() can be used to find and
retrieve the relevant pci_root_info stored on the aforementioned linked
list.

Since the value of the "info" variable following the first loop is never
used in any meaningful way the assigned can be removed.

Related:
  commit d28e5ac2a07e ("x86/PCI: dynamically allocate pci_root_info for native host bridge drivers")
  commit a10bb128b64f ("x86/PCI: put busn resource in pci_root_info for native host bridge drivers")

Addresses-Coverity-ID: 1222153 ("Unused value")
Signed-off-by: Krzysztof Wilczyński <kw@xxxxxxxxx>
---
 arch/x86/pci/amd_bus.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/pci/amd_bus.c b/arch/x86/pci/amd_bus.c
index bfa50e65ef6c..ae744b6a0785 100644
--- a/arch/x86/pci/amd_bus.c
+++ b/arch/x86/pci/amd_bus.c
@@ -126,7 +126,7 @@ static int __init early_root_info_init(void)
 		node = (reg >> 4) & 0x07;
 		link = (reg >> 8) & 0x03;
 
-		info = alloc_pci_root_info(min_bus, max_bus, node, link);
+		alloc_pci_root_info(min_bus, max_bus, node, link);
 	}
 
 	/*
-- 
2.31.0




[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux