2020-09-17 06:57:30

by Liu Shixin

[permalink] [raw]
Subject: [PATCH -next] PCI: dwc: Remove set but not used variable

Fixes gcc '-Wunused-but-set-variable' warning:

drivers/pci/controller/dwc/pci-dra7xx.c: In function 'dra7xx_pcie_establish_link':
drivers/pci/controller/dwc/pci-dra7xx.c:142:6: warning: unused variable 'exp_cap_off'
[-Wunused-variable]

After 3af45d34d30c ("PCI: dwc: Centralize link gen setting"), variable 'exp_cap_off'
is never used. Remove it to avoid build warning.

Signed-off-by: Liu Shixin <[email protected]>
---
drivers/pci/controller/dwc/pci-dra7xx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pci/controller/dwc/pci-dra7xx.c b/drivers/pci/controller/dwc/pci-dra7xx.c
index 69cd43f74260..7bac7c54b2aa 100644
--- a/drivers/pci/controller/dwc/pci-dra7xx.c
+++ b/drivers/pci/controller/dwc/pci-dra7xx.c
@@ -139,7 +139,7 @@ static int dra7xx_pcie_establish_link(struct dw_pcie *pci)
struct dra7xx_pcie *dra7xx = to_dra7xx_pcie(pci);
struct device *dev = pci->dev;
u32 reg;
- u32 exp_cap_off = dw_pcie_find_capability(pci, PCI_CAP_ID_EXP);
+ dw_pcie_find_capability(pci, PCI_CAP_ID_EXP);

if (dw_pcie_link_up(pci)) {
dev_err(dev, "link is already up\n");
--
2.25.1


2020-09-17 15:09:16

by Rob Herring (Arm)

[permalink] [raw]
Subject: Re: [PATCH -next] PCI: dwc: Remove set but not used variable

On Thu, Sep 17, 2020 at 12:55 AM Liu Shixin <[email protected]> wrote:
>
> Fixes gcc '-Wunused-but-set-variable' warning:
>
> drivers/pci/controller/dwc/pci-dra7xx.c: In function 'dra7xx_pcie_establish_link':
> drivers/pci/controller/dwc/pci-dra7xx.c:142:6: warning: unused variable 'exp_cap_off'
> [-Wunused-variable]
>
> After 3af45d34d30c ("PCI: dwc: Centralize link gen setting"), variable 'exp_cap_off'
> is never used. Remove it to avoid build warning.

Already fixed in next.

Rob