lkml.org 
[lkml]   [2017]   [Oct]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 2/3] powernv/pci: Use common code in pnv_ioda_pick_m64_pe()
From
Date
On 18/10/17 02:39, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> 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 <elfring@users.sourceforge.net>
> ---
> 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

\
 
 \ /
  Last update: 2017-10-22 17:08    [W:0.046 / U:3.440 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site