Re: [PATCH RESEND v5 11/18] PCI: dwc: Organize local variables usage

Bjorn Helgaas
2022-06-28T23:33:36Z

On Fri, Jun 24, 2022 at 05:34:21PM +0300, Serge Semin wrote:
> There are several places in the common DW PCIe code with incoherent local
> variables usage: a variable is defined and initialized with a structure
> field, but the structure pointer is de-referenced to access that field
> anyway; the local variable is defined and initialized but either used just
> once or not used afterwards in the main part of the subsequent method.
> It's mainly concerns the pcie_port.dev field. Let's fix that in the
> relevant places.
>
> Signed-off-by: Serge Semin <Sergey.Semin@baikalelectronics.ru>
> Reviewed-by: Rob Herring <robh@kernel.org>
>
> ---
>
> Changelog v4:
> - This is a new patch created on the v4 lap of the series.
> ---
> drivers/pci/controller/dwc/pcie-designware-host.c | 12 ++++++------
> drivers/pci/controller/dwc/pcie-designware.c | 8 +++-----
> 2 files changed, 9 insertions(+), 11 deletions(-)

> @@ -633,7 +633,7 @@ void dw_pcie_setup_rc(struct pcie_port *pp)
> }
>
> if (pci->num_ob_windows <= atu_idx)
> - dev_warn(pci->dev, "Resources exceed number of ATU entries (%d)\n",
> + dev_warn(dev, "Resources exceed number of ATU entries (%d)\n",

I dropped this hunk because of this:

drivers/pci/controller/dwc/pcie-designware-host.c:634:13: error: ‘dev’ undeclared (first use in this function); did you mean ‘cdev’?
634 | dev_warn(dev, "Resources exceed number of ATU entries (%d)\n",

> pci->num_ob_windows);
> }
>