All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86/PCI: Remove unused assignment to variable info
@ 2021-04-20 21:09 Krzysztof Wilczyński
  2021-04-30 19:19 ` Bjorn Helgaas
  0 siblings, 1 reply; 2+ messages in thread
From: Krzysztof Wilczyński @ 2021-04-20 21:09 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Thomas Gleixner, Ingo Molnar, Borislav Petkov, H. Peter Anvin,
	x86, linux-pci

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@linux.com>
---
 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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-04-30 19:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-04-20 21:09 [PATCH] x86/PCI: Remove unused assignment to variable info Krzysztof Wilczyński
2021-04-30 19:19 ` Bjorn Helgaas

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.