Skip to contentSkip to conversation

PCI: endpoint: remove redundant initialization of pointer dev

PATCH Applied Colin King 3 participants 3 messages Mar 26, 2021 – Apr 13, 2021

Subsystems (3)
lore
Share & tools
lore

Colin King

author
#0 lore raw

PATCH 1/1 PCI: endpoint: remove redundant initialization of pointer dev

From: Colin Ian King <[email protected]>

The pointer dev is being initialized with a value that is never read and it is being updated later with a new value. The initialization is redundant and can be removed.

Addresses-Coverity: ("Unused value")

---
 drivers/pci/endpoint/pci-epf-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/endpoint/pci-epf-core.c +1 -1
index 7646c8660d42..e9289d10f822 100644
@@ -113,7 +113,7 @@ EXPORT_SYMBOL_GPL(pci_epf_bind);
 void pci_epf_free_space(struct pci_epf *epf, void *addr, enum pci_barno bar,
 			enum pci_epc_interface_type type)
 {
-	struct device *dev = epf->epc->dev.parent;
+	struct device *dev;
 	struct pci_epf_bar *epf_bar;
 	struct pci_epc *epc;
 
Signature · 1 line
2.30.2
Reviewed-by on v1 1/1
#1 lore raw

Hi Colin,

Quoted 3 lines

The pointer dev is being initialized with a value that is never read and it is being updated later with a new value. The initialization is redundant and can be removed.

[...]

drivers/pci/endpoint/pci-epf-core.c EXPORT_SYMBOL_GPL(pci_epf_bind); · line 118

Quoted 4 lines
drivers/pci/endpoint/pci-epf-core.c +1 -1
-	struct device *dev = epf->epc->dev.parent;
+	struct device *dev;
 	struct pci_epf_bar *epf_bar;
 	struct pci_epc *epc;

Thank you!

Krzysztof