From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pd0-f177.google.com (mail-pd0-f177.google.com [209.85.192.177]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 24ED42C00AE for ; Wed, 15 May 2013 02:57:35 +1000 (EST) Received: by mail-pd0-f177.google.com with SMTP id g10so593329pdj.36 for ; Tue, 14 May 2013 09:57:33 -0700 (PDT) Message-ID: <51926CF6.1050706@gmail.com> Date: Wed, 15 May 2013 00:57:26 +0800 From: Liu Jiang MIME-Version: 1.0 To: Yinghai Lu Subject: Re: [PATCH v2, part 1 3/9] PCI: Convert alloc_pci_dev(void) to pci_alloc_dev(bus) instead References: <1368461313-4371-1-git-send-email-jiang.liu@huawei.com> <1368461313-4371-4-git-send-email-jiang.liu@huawei.com> <5191F53E.4000305@cn.fujitsu.com> <51925136.5050302@gmail.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Cc: Neela Syam Kolli , "sparclinux@vger.kernel.org" , Toshi Kani , Jiang Liu , Linux-Scsi , David Airlie , Greg Kroah-Hartman , linuxppc-dev@lists.ozlabs.org, Linux Kernel Mailing List , "James E.J. Bottomley" , "Rafael J . Wysocki" , Bjorn Helgaas , Yijing Wang , "linux-pci@vger.kernel.org" , Gu Zheng , Paul Mackerras , Andrew Morton , Myron Stowe , "David S. Miller" List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , On Tue 14 May 2013 11:10:33 PM CST, Yinghai Lu wrote: > On Tue, May 14, 2013 at 7:59 AM, Liu Jiang wrote: >> On 05/14/2013 04:26 PM, Gu Zheng wrote: >> I suggest to use pci_release_dev() instead because it also needs to >> release OF related resources. >> I will update it in next version. >> >> diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c >> index bc075a3..2ac6338 100644 >> --- a/drivers/pci/probe.c >> +++ b/drivers/pci/probe.c >> @@ -1281,7 +1281,7 @@ static struct pci_dev *pci_scan_device(struct pci_bus >> *bus >> pci_set_of_node(dev); >> >> if (pci_setup_device(dev)) { >> - kfree(dev); >> + pci_release_dev(&dev->dev); >> return NULL; > > no, should move pci_set_of_node calling into pci_setup_device. > > Yinghai I'm not sure whether we should call pci_set_of_node() for SR-IOV devices too, any suggestions here?