2021-03-26 19:14:26

by Colin King

[permalink] [raw]
Subject: [PATCH] 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")
Signed-off-by: Colin Ian King <[email protected]>
---
drivers/pci/endpoint/pci-epf-core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pci/endpoint/pci-epf-core.c b/drivers/pci/endpoint/pci-epf-core.c
index 7646c8660d42..e9289d10f822 100644
--- a/drivers/pci/endpoint/pci-epf-core.c
+++ b/drivers/pci/endpoint/pci-epf-core.c
@@ -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;

--
2.30.2


2021-03-26 22:18:44

by Krzysztof Wilczyński

[permalink] [raw]
Subject: Re: [PATCH] PCI: endpoint: remove redundant initialization of pointer dev

Hi Colin,

> 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.
[...]
> - struct device *dev = epf->epc->dev.parent;
> + struct device *dev;
> struct pci_epf_bar *epf_bar;
> struct pci_epc *epc;

Thank you!

Reviewed-by: Krzysztof Wilczyński <[email protected]>

Krzysztof

2021-04-13 14:31:00

by Lorenzo Pieralisi

[permalink] [raw]
Subject: Re: [PATCH] PCI: endpoint: remove redundant initialization of pointer dev

On Fri, 26 Mar 2021 19:09:09 +0000, Colin King wrote:
> 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.

Applied to pci/endpoint, thanks!

[1/1] PCI: endpoint: Remove redundant initialization of pointer dev
https://git.kernel.org/lpieralisi/pci/c/80c253bd7f

Thanks,
Lorenzo