From: Dan Carpenter <dan.carpenter@oracle.com>
To: robh@kernel.org
Cc: Rob Herring <robh@kernel.org>, linux-pci@vger.kernel.org
Subject: [bug report] PCI: dwc: Move "dbi", "dbi2", and "addr_space" resource setup into common code
Date: Tue, 1 Dec 2020 11:50:07 +0300 [thread overview]
Message-ID: <X8YDv+bzaeXONOrt@mwanda> (raw)
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.
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
next reply other threads:[~2020-12-01 8:51 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-12-01 8:50 Dan Carpenter [this message]
2020-12-01 15:01 ` [bug report] PCI: dwc: Move "dbi", "dbi2", and "addr_space" resource setup into common code Rob Herring
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=X8YDv+bzaeXONOrt@mwanda \
--to=dan.carpenter@oracle.com \
--cc=linux-pci@vger.kernel.org \
--cc=robh@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