linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Rob Herring <robh@kernel.org>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: PCI <linux-pci@vger.kernel.org>
Subject: Re: [bug report] PCI: dwc: Move "dbi", "dbi2", and "addr_space" resource setup into common code
Date: Tue, 1 Dec 2020 08:01:40 -0700	[thread overview]
Message-ID: <CAL_JsqJzHQ6ZoysEyPm6T3t4sZ-9AUsc+CvTaZhbMHpy=djYmg@mail.gmail.com> (raw)
In-Reply-To: <X8YDv+bzaeXONOrt@mwanda>

On Tue, Dec 1, 2020 at 1:50 AM Dan Carpenter <dan.carpenter@oracle.com> wrote:
>
> Hello Rob Herring,
>
> The patch a0fd361db8e5: "PCI: dwc: Move "dbi", "dbi2", and
> "addr_space" resource setup into common code" from Nov 5, 2020, leads
> to the following static checker warning:
>
>         drivers/pci/controller/dwc/pcie-designware-host.c:337 dw_pcie_host_init()
>         warn: 'pci->dbi_base' is an error pointer or valid
>
> drivers/pci/controller/dwc/pcie-designware-host.c
>    304          cfg_res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "config");
>    305          if (cfg_res) {
>    306                  pp->cfg0_size = resource_size(cfg_res);
>    307                  pp->cfg0_base = cfg_res->start;
>    308          } else if (!pp->va_cfg0_base) {
>    309                  dev_err(dev, "Missing *config* reg space\n");
>    310          }
>    311
>    312          if (!pci->dbi_base) {
>    313                  struct resource *dbi_res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dbi");
>    314                  pci->dbi_base = devm_pci_remap_cfg_resource(dev, dbi_res);
>                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> We set pci->dbi_base here now.
>
>    315                  if (IS_ERR(pci->dbi_base))
>    316                          return PTR_ERR(pci->dbi_base);
>    317          }
>    318
>    319          bridge = devm_pci_alloc_host_bridge(dev, 0);
>    320          if (!bridge)
>    321                  return -ENOMEM;
>    322
>    323          pp->bridge = bridge;
>    324
>    325          /* Get the I/O and memory ranges from DT */
>    326          resource_list_for_each_entry(win, &bridge->windows) {
>    327                  switch (resource_type(win->res)) {
>    328                  case IORESOURCE_IO:
>    329                          pp->io_size = resource_size(win->res);
>    330                          pp->io_bus_addr = win->res->start - win->offset;
>    331                          pp->io_base = pci_pio_to_address(win->res->start);
>    332                          break;
>    333                  case 0:
>    334                          dev_err(dev, "Missing *config* reg space\n");
>    335                          pp->cfg0_size = resource_size(win->res);
>    336                          pp->cfg0_base = win->res->start;
>    337                          if (!pci->dbi_base) {
>                                     ^^^^^^^^^^^^^^
> So this is dead code because pci->dbi_base is never NULL.

I think this code should not be needed any more. It was for
compatibility with old DTs. I'll check the history.

Rob

>
>    338                                  pci->dbi_base = devm_pci_remap_cfgspace(dev,
>    339                                                                  pp->cfg0_base,
>    340                                                                  pp->cfg0_size);
>    341                                  if (!pci->dbi_base) {
>    342                                          dev_err(dev, "Error with ioremap\n");
>    343                                          return -ENOMEM;
>    344                                  }
>    345                          }
>    346                          break;
>    347                  }
>    348          }
>
> regards,
> dan carpenter

      reply	other threads:[~2020-12-01 15:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-01  8:50 [bug report] PCI: dwc: Move "dbi", "dbi2", and "addr_space" resource setup into common code Dan Carpenter
2020-12-01 15:01 ` Rob Herring [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAL_JsqJzHQ6ZoysEyPm6T3t4sZ-9AUsc+CvTaZhbMHpy=djYmg@mail.gmail.com' \
    --to=robh@kernel.org \
    --cc=dan.carpenter@oracle.com \
    --cc=linux-pci@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).