From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753060Ab3FFQQy (ORCPT ); Thu, 6 Jun 2013 12:16:54 -0400 Received: from mail-pb0-f47.google.com ([209.85.160.47]:58039 "EHLO mail-pb0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751353Ab3FFQQw (ORCPT ); Thu, 6 Jun 2013 12:16:52 -0400 Message-ID: <51B0B5EB.2070807@gmail.com> Date: Fri, 07 Jun 2013 00:16:43 +0800 From: Jiang Liu User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130404 Thunderbird/17.0.5 MIME-Version: 1.0 To: Bjorn Helgaas CC: Yinghai Lu , Gu Zheng , "Rafael J . Wysocki" , Greg Kroah-Hartman , Toshi Kani , Myron Stowe , Yijing Wang , "linux-pci@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Jiang Liu , Benjamin Herrenschmidt , Paul Mackerras , "David S. Miller" , David Airlie , Neela Syam Kolli , "James E.J. Bottomley" , Andrew Morton , linuxppc-dev , sparclinux@vger.kernel.org, "linux-scsi@vger.kernel.org" Subject: Re: [PATCH v3, part1 03/10] PCI: Convert alloc_pci_dev(void) to pci_alloc_dev(bus) instead References: <1369489718-25869-1-git-send-email-jiang.liu@huawei.com> <1369489718-25869-4-git-send-email-jiang.liu@huawei.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu 06 Jun 2013 04:07:18 AM CST, Bjorn Helgaas wrote: > On Sat, May 25, 2013 at 7:48 AM, Jiang Liu wrote: >> From: Gu Zheng >> >> Use the new pci_alloc_dev(bus) to replace the existing using of >> alloc_pci_dev(void). >> ... > >> diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c >> index 26df9c8..d5d18a0 100644 >> --- a/drivers/pci/probe.c >> +++ b/drivers/pci/probe.c >> @@ -1130,6 +1130,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); > > I think we should drop the pci_bus reference *last* (before the > kfree). Otherwise, we have to audit pci_release_capabilities() and > pci_release_of_node() to make sure they don't use pci_dev->bus. > > I made this change on my branch already; just let me know if you object. Hi Bjorn, You are right, thanks for fixing it. > > Bjorn From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jiang Liu Date: Thu, 06 Jun 2013 16:16:43 +0000 Subject: Re: [PATCH v3, part1 03/10] PCI: Convert alloc_pci_dev(void) to pci_alloc_dev(bus) instead Message-Id: <51B0B5EB.2070807@gmail.com> List-Id: References: <1369489718-25869-1-git-send-email-jiang.liu@huawei.com> <1369489718-25869-4-git-send-email-jiang.liu@huawei.com> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Bjorn Helgaas Cc: Yinghai Lu , Gu Zheng , "Rafael J . Wysocki" , Greg Kroah-Hartman , Toshi Kani , Myron Stowe , Yijing Wang , "linux-pci@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Jiang Liu , Benjamin Herrenschmidt , Paul Mackerras , "David S. Miller" , David Airlie , Neela Syam Kolli , "James E.J. Bottomley" , Andrew Morton , linuxppc-dev , sparclinux@vger.kernel.org, "linux-scsi@vger.kernel.org" On Thu 06 Jun 2013 04:07:18 AM CST, Bjorn Helgaas wrote: > On Sat, May 25, 2013 at 7:48 AM, Jiang Liu wrote: >> From: Gu Zheng >> >> Use the new pci_alloc_dev(bus) to replace the existing using of >> alloc_pci_dev(void). >> ... > >> diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c >> index 26df9c8..d5d18a0 100644 >> --- a/drivers/pci/probe.c >> +++ b/drivers/pci/probe.c >> @@ -1130,6 +1130,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); > > I think we should drop the pci_bus reference *last* (before the > kfree). Otherwise, we have to audit pci_release_capabilities() and > pci_release_of_node() to make sure they don't use pci_dev->bus. > > I made this change on my branch already; just let me know if you object. Hi Bjorn, You are right, thanks for fixing it. > > Bjorn From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pb0-x230.google.com (mail-pb0-x230.google.com [IPv6:2607:f8b0:400e:c01::230]) (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 8033A2C0096 for ; Fri, 7 Jun 2013 02:16:54 +1000 (EST) Received: by mail-pb0-f48.google.com with SMTP id md4so3448736pbc.21 for ; Thu, 06 Jun 2013 09:16:51 -0700 (PDT) Message-ID: <51B0B5EB.2070807@gmail.com> Date: Fri, 07 Jun 2013 00:16:43 +0800 From: Jiang Liu MIME-Version: 1.0 To: Bjorn Helgaas Subject: Re: [PATCH v3, part1 03/10] PCI: Convert alloc_pci_dev(void) to pci_alloc_dev(bus) instead References: <1369489718-25869-1-git-send-email-jiang.liu@huawei.com> <1369489718-25869-4-git-send-email-jiang.liu@huawei.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8 Cc: Neela Syam Kolli , sparclinux@vger.kernel.org, Toshi Kani , Jiang Liu , "linux-scsi@vger.kernel.org" , David Airlie , Myron Stowe , linuxppc-dev , "linux-pci@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "James E.J. Bottomley" , "Rafael J . Wysocki" , Yijing Wang , Greg Kroah-Hartman , Gu Zheng , Paul Mackerras , Andrew Morton , Yinghai Lu , "David S. Miller" List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , On Thu 06 Jun 2013 04:07:18 AM CST, Bjorn Helgaas wrote: > On Sat, May 25, 2013 at 7:48 AM, Jiang Liu wrote: >> From: Gu Zheng >> >> Use the new pci_alloc_dev(bus) to replace the existing using of >> alloc_pci_dev(void). >> ... > >> diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c >> index 26df9c8..d5d18a0 100644 >> --- a/drivers/pci/probe.c >> +++ b/drivers/pci/probe.c >> @@ -1130,6 +1130,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); > > I think we should drop the pci_bus reference *last* (before the > kfree). Otherwise, we have to audit pci_release_capabilities() and > pci_release_of_node() to make sure they don't use pci_dev->bus. > > I made this change on my branch already; just let me know if you object. Hi Bjorn, You are right, thanks for fixing it. > > Bjorn