Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752716Ab3EMRXc (ORCPT ); Mon, 13 May 2013 13:23:32 -0400 Received: from mail-ie0-f177.google.com ([209.85.223.177]:47916 "EHLO mail-ie0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751419Ab3EMRXa (ORCPT ); Mon, 13 May 2013 13:23:30 -0400 MIME-Version: 1.0 In-Reply-To: <1368461313-4371-4-git-send-email-jiang.liu@huawei.com> References: <1368461313-4371-1-git-send-email-jiang.liu@huawei.com> <1368461313-4371-4-git-send-email-jiang.liu@huawei.com> Date: Mon, 13 May 2013 10:23:29 -0700 X-Google-Sender-Auth: 0KCDK5vKWBd287wk-a43CaPqicc Message-ID: Subject: Re: [PATCH v2, part 1 3/9] PCI: Convert alloc_pci_dev(void) to pci_alloc_dev(bus) instead From: Yinghai Lu To: Jiang Liu Cc: Bjorn Helgaas , Gu Zheng , "Rafael J . Wysocki" , Greg Kroah-Hartman , Toshi Kani , Myron Stowe , Yijing Wang , "linux-pci@vger.kernel.org" , Linux Kernel Mailing List , Benjamin Herrenschmidt , Paul Mackerras , "David S. Miller" , David Airlie , Neela Syam Kolli , "James E.J. Bottomley" , Andrew Morton , linuxppc-dev@lists.ozlabs.org, "sparclinux@vger.kernel.org" , Linux-Scsi , Jiang Liu Content-Type: text/plain; charset=ISO-8859-1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1327 Lines: 36 On Mon, May 13, 2013 at 9:08 AM, Jiang Liu wrote: > From: Gu Zheng > diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c > index 4f0bc0a..bc075a3 100644 > --- a/drivers/pci/probe.c > +++ b/drivers/pci/probe.c > @@ -1131,6 +1131,7 @@ static void pci_release_dev(struct device *dev) > struct pci_dev *pci_dev; > > pci_dev = to_pci_dev(dev); > + pci_bus_put(pci_dev->bus); > pci_release_capabilities(pci_dev); > pci_release_of_node(pci_dev); > kfree(pci_dev); > @@ -1269,11 +1270,10 @@ static struct pci_dev *pci_scan_device(struct pci_bus *bus, int devfn) > if (!pci_bus_read_dev_vendor_id(bus, devfn, &l, 60*1000)) > return NULL; > > - dev = alloc_pci_dev(); > + dev = pci_alloc_dev(bus); > if (!dev) > return NULL; > > - dev->bus = bus; > dev->devfn = devfn; > dev->vendor = l & 0xffff; > dev->device = (l >> 16) & 0xffff; in pci_setup_device() fail path, it release the ref to that bus. Yinghai -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/