[PATCH 39/46] pci: aspm: reduce scope of variables

Colin King colin.king at canonical.com
Tue Jan 13 19:04:58 UTC 2015


From: Colin Ian King <colin.king at canonical.com>

cppcheck is picking up some minor style issues which can
be easily fixed:

[src/pci/aspm/aspm.c:227]:
	(style) The scope of the variable 'target' can be reduced.

Signed-off-by: Colin Ian King <colin.king at canonical.com>
---
 src/pci/aspm/aspm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/pci/aspm/aspm.c b/src/pci/aspm/aspm.c
index 4ccb178..0277311 100644
--- a/src/pci/aspm/aspm.c
+++ b/src/pci/aspm/aspm.c
@@ -224,12 +224,12 @@ static int pcie_check_aspm_registers(fwts_framework *fw)
 
 	/* Check aspm registers from the list of pci devices */
 	for (lcur = dev_list.head; lcur; lcur = lcur->next) {
-		struct pci_device *target, *cur = (struct pci_device *)lcur->data;
+		struct pci_device *cur = (struct pci_device *)lcur->data;
 
 		/* Find PCI Bridge (PCIE Root Port) and the attached device  */
 		if (cur->config[FWTS_PCI_CONFIG_HEADER_TYPE] & 0x01) {
 			for (ltarget = dev_list.head; ltarget; ltarget = ltarget->next) {
-				target = (struct pci_device *)ltarget->data;
+				struct pci_device *target = (struct pci_device *)ltarget->data;
 				if (target->bus == cur->config[FWTS_PCI_CONFIG_TYPE1_SECONDARY_BUS_NUMBER]) {
 					pcie_compare_rp_dev_aspm_registers(fw, cur, target);
 					break;
-- 
2.1.4




More information about the fwts-devel mailing list