Hello Christoph Hellwig,

The patch 4167b2ad5182: "PCI: Remove NULL device handling from PCI
DMA API" from Jan 10, 2018, leads to the following static checker
warning:

        drivers/net/ethernet/amd/pcnet32.c:1921 pcnet32_probe1()
        warn: variable dereferenced before check 'pdev' (see line 1843)

drivers/net/ethernet/amd/pcnet32.c
  1839  
  1840          dev->base_addr = ioaddr;
  1841          lp = netdev_priv(dev);
  1842          /* pci_alloc_consistent returns page-aligned memory, so we do 
not have to check the alignment */
  1843          lp->init_block = pci_alloc_consistent(pdev, 
sizeof(*lp->init_block),
                                                      ^^^^
This function is called with a NULL "pdev" when we're probing from
pcnet32_probe_vlbus().

  1844                                                &lp->init_dma_addr);
  1845          if (!lp->init_block) {
  1846                  if (pcnet32_debug & NETIF_MSG_PROBE)
  1847                          pr_err("Consistent memory allocation failed\n");
  1848                  ret = -ENOMEM;
  1849                  goto err_free_netdev;
  1850          }
  1851          lp->pci_dev = pdev;
  1852  
  1853          lp->dev = dev;
  1854  

regards,
dan carpenter

Reply via email to