From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dan Carpenter Subject: [bug report] PCI: Remove NULL device handling from PCI DMA API Date: Tue, 30 Oct 2018 12:10:43 +0300 Message-ID: <20181030091043.seqnj5fahscgr46x@kili.mountain> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: netdev@vger.kernel.org, Bjorn Helgaas To: hch@lst.de Return-path: Received: from userp2130.oracle.com ([156.151.31.86]:47784 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726479AbeJ3SDd (ORCPT ); Tue, 30 Oct 2018 14:03:33 -0400 Content-Disposition: inline Sender: netdev-owner@vger.kernel.org List-ID: 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