From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pd0-f181.google.com (mail-pd0-f181.google.com [209.85.192.181]) (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 4B3A42C00A4 for ; Thu, 16 May 2013 00:39:28 +1000 (EST) Received: by mail-pd0-f181.google.com with SMTP id p11so1416770pdj.40 for ; Wed, 15 May 2013 07:39:25 -0700 (PDT) Message-ID: <51939E16.9090105@gmail.com> Date: Wed, 15 May 2013 22:39:18 +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> <51926CF6.1050706@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 Wed 15 May 2013 02:52:51 AM CST, Yinghai Lu wrote: > On Tue, May 14, 2013 at 9:57 AM, Liu Jiang wrote: >> 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? > > or just move down pci_set_of_node after pci_setup_device? > > anyway that is another bug. > > Yinghai I'm not familiar with the OF logic and can't make sure whether pci_setup_device() has dependency on dev->of_node. Feel it's more safe to call pci_release_of_node() on failing path instead of tuning call-site of pci_set_of_node().