From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965032AbdJRFZB (ORCPT ); Wed, 18 Oct 2017 01:25:01 -0400 Received: from mail-it0-f68.google.com ([209.85.214.68]:50298 "EHLO mail-it0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754983AbdJRFY7 (ORCPT ); Wed, 18 Oct 2017 01:24:59 -0400 X-Google-Smtp-Source: ABhQp+TzFBkrH3sNsHYa4p0NJcttJ0xQDzBTLpTN1H8wmuZl9g6oH+wJKwIbc6bQyuDSJhF66vr8vw== Subject: Re: [PATCH 2/3] powernv/pci: Use common code in pnv_ioda_pick_m64_pe() To: SF Markus Elfring , linuxppc-dev@lists.ozlabs.org, Alistair Popple , Benjamin Herrenschmidt , David Gibson , Gavin Shan , Michael Ellerman , Paul Mackerras , Rob Herring , Russell Currey Cc: LKML , kernel-janitors@vger.kernel.org References: <549d0b6b-f875-c524-d867-742745117c1e@users.sourceforge.net> <84df26ea-74a3-14e5-9f13-a35486e9a95d@users.sourceforge.net> From: Alexey Kardashevskiy Message-ID: <6c6611ec-bd22-593c-3cca-106374cf2320@ozlabs.ru> Date: Wed, 18 Oct 2017 16:24:51 +1100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <84df26ea-74a3-14e5-9f13-a35486e9a95d@users.sourceforge.net> Content-Type: text/plain; charset=utf-8 Content-Language: en-AU Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 18/10/17 02:39, SF Markus Elfring wrote: > From: Markus Elfring > Date: Tue, 17 Oct 2017 17:07:54 +0200 > > Add a jump target so that a bit of code can be better reused > at the end of this function. Rather than moving bits around, I'd rather allocate pe_alloc on stack and ditch kfree() at all. I'll make a patch for this. > > Signed-off-by: Markus Elfring > --- > arch/powerpc/platforms/powernv/pci-ioda.c | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) > > diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c > index 17c0330bb059..98d9435240f4 100644 > --- a/arch/powerpc/platforms/powernv/pci-ioda.c > +++ b/arch/powerpc/platforms/powernv/pci-ioda.c > @@ -364,21 +364,20 @@ static struct pnv_ioda_pe *pnv_ioda_pick_m64_pe(struct pci_bus *bus, bool all) > /* Figure out reserved PE numbers by the PE */ > pnv_ioda_reserve_m64_pe(bus, pe_alloc, all); > > + master_pe = NULL; > + > /* > * the current bus might not own M64 window and that's all > * contributed by its child buses. For the case, we needn't > * pick M64 dependent PE#. > */ > - if (bitmap_empty(pe_alloc, phb->ioda.total_pe_num)) { > - kfree(pe_alloc); > - return NULL; > - } > + if (bitmap_empty(pe_alloc, phb->ioda.total_pe_num)) > + goto free_pe; > > /* > * Figure out the master PE and put all slave PEs to master > * PE's list to form compound PE. > */ > - master_pe = NULL; > i = -1; > while ((i = find_next_bit(pe_alloc, phb->ioda.total_pe_num, i + 1)) < > phb->ioda.total_pe_num) { > @@ -416,6 +415,7 @@ static struct pnv_ioda_pe *pnv_ioda_pick_m64_pe(struct pci_bus *bus, bool all) > } > } > > +free_pe: > kfree(pe_alloc); > return master_pe; > } > -- Alexey From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alexey Kardashevskiy Date: Wed, 18 Oct 2017 05:24:51 +0000 Subject: Re: [PATCH 2/3] powernv/pci: Use common code in pnv_ioda_pick_m64_pe() Message-Id: <6c6611ec-bd22-593c-3cca-106374cf2320@ozlabs.ru> List-Id: References: <549d0b6b-f875-c524-d867-742745117c1e@users.sourceforge.net> <84df26ea-74a3-14e5-9f13-a35486e9a95d@users.sourceforge.net> In-Reply-To: <84df26ea-74a3-14e5-9f13-a35486e9a95d@users.sourceforge.net> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: SF Markus Elfring , linuxppc-dev@lists.ozlabs.org, Alistair Popple , Benjamin Herrenschmidt , David Gibson , Gavin Shan , Michael Ellerman , Paul Mackerras , Rob Herring , Russell Currey Cc: LKML , kernel-janitors@vger.kernel.org On 18/10/17 02:39, SF Markus Elfring wrote: > From: Markus Elfring > Date: Tue, 17 Oct 2017 17:07:54 +0200 > > Add a jump target so that a bit of code can be better reused > at the end of this function. Rather than moving bits around, I'd rather allocate pe_alloc on stack and ditch kfree() at all. I'll make a patch for this. > > Signed-off-by: Markus Elfring > --- > arch/powerpc/platforms/powernv/pci-ioda.c | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) > > diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c > index 17c0330bb059..98d9435240f4 100644 > --- a/arch/powerpc/platforms/powernv/pci-ioda.c > +++ b/arch/powerpc/platforms/powernv/pci-ioda.c > @@ -364,21 +364,20 @@ static struct pnv_ioda_pe *pnv_ioda_pick_m64_pe(struct pci_bus *bus, bool all) > /* Figure out reserved PE numbers by the PE */ > pnv_ioda_reserve_m64_pe(bus, pe_alloc, all); > > + master_pe = NULL; > + > /* > * the current bus might not own M64 window and that's all > * contributed by its child buses. For the case, we needn't > * pick M64 dependent PE#. > */ > - if (bitmap_empty(pe_alloc, phb->ioda.total_pe_num)) { > - kfree(pe_alloc); > - return NULL; > - } > + if (bitmap_empty(pe_alloc, phb->ioda.total_pe_num)) > + goto free_pe; > > /* > * Figure out the master PE and put all slave PEs to master > * PE's list to form compound PE. > */ > - master_pe = NULL; > i = -1; > while ((i = find_next_bit(pe_alloc, phb->ioda.total_pe_num, i + 1)) < > phb->ioda.total_pe_num) { > @@ -416,6 +415,7 @@ static struct pnv_ioda_pe *pnv_ioda_pick_m64_pe(struct pci_bus *bus, bool all) > } > } > > +free_pe: > kfree(pe_alloc); > return master_pe; > } > -- Alexey