* [PATCH 0/3] PowerNV-PCI: Adjustments for two function implementations
@ 2017-10-17 15:35 ` SF Markus Elfring
0 siblings, 0 replies; 16+ messages in thread
From: SF Markus Elfring @ 2017-10-17 15:35 UTC (permalink / raw)
To: linuxppc-dev, Alexey Kardashevskiy, Alistair Popple,
Benjamin Herrenschmidt, David Gibson, Gavin Shan,
Michael Ellerman, Paul Mackerras, Rob Herring, Russell Currey
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 17 Oct 2017 17:27:37 +0200
Three update suggestions were taken into account
from static source code analysis.
Markus Elfring (3):
Delete an error message for a failed memory allocation in pnv_ioda_pick_m64_pe()
Use common code in pnv_ioda_pick_m64_pe()
Improve a size determination in pnv_pci_init_ioda_phb()
arch/powerpc/platforms/powernv/pci-ioda.c | 17 +++++++----------
1 file changed, 7 insertions(+), 10 deletions(-)
--
2.14.2
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH 0/3] PowerNV-PCI: Adjustments for two function implementations
@ 2017-10-17 15:35 ` SF Markus Elfring
0 siblings, 0 replies; 16+ messages in thread
From: SF Markus Elfring @ 2017-10-17 15:35 UTC (permalink / raw)
To: linuxppc-dev, Alexey Kardashevskiy, Alistair Popple,
Benjamin Herrenschmidt, David Gibson, Gavin Shan,
Michael Ellerman, Paul Mackerras, Rob Herring, Russell Currey
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 17 Oct 2017 17:27:37 +0200
Three update suggestions were taken into account
from static source code analysis.
Markus Elfring (3):
Delete an error message for a failed memory allocation in pnv_ioda_pick_m64_pe()
Use common code in pnv_ioda_pick_m64_pe()
Improve a size determination in pnv_pci_init_ioda_phb()
arch/powerpc/platforms/powernv/pci-ioda.c | 17 +++++++----------
1 file changed, 7 insertions(+), 10 deletions(-)
--
2.14.2
^ permalink raw reply [flat|nested] 16+ messages in thread
* [PATCH 1/3] powernv/pci: Delete an error message for a failed memory allocation in pnv_ioda_pick_m64_pe()
2017-10-17 15:35 ` SF Markus Elfring
@ 2017-10-17 15:37 ` SF Markus Elfring
-1 siblings, 0 replies; 16+ messages in thread
From: SF Markus Elfring @ 2017-10-17 15:37 UTC (permalink / raw)
To: linuxppc-dev, Alexey Kardashevskiy, Alistair Popple,
Benjamin Herrenschmidt, David Gibson, Gavin Shan,
Michael Ellerman, Paul Mackerras, Rob Herring, Russell Currey
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 17 Oct 2017 16:52:43 +0200
Omit an extra message for a memory allocation failure in this function.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
arch/powerpc/platforms/powernv/pci-ioda.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c
index fb5cd7511189..17c0330bb059 100644
--- a/arch/powerpc/platforms/powernv/pci-ioda.c
+++ b/arch/powerpc/platforms/powernv/pci-ioda.c
@@ -358,11 +358,8 @@ static struct pnv_ioda_pe *pnv_ioda_pick_m64_pe(struct pci_bus *bus, bool all)
/* Allocate bitmap */
size = _ALIGN_UP(phb->ioda.total_pe_num / 8, sizeof(unsigned long));
pe_alloc = kzalloc(size, GFP_KERNEL);
- if (!pe_alloc) {
- pr_warn("%s: Out of memory !\n",
- __func__);
+ if (!pe_alloc)
return NULL;
- }
/* Figure out reserved PE numbers by the PE */
pnv_ioda_reserve_m64_pe(bus, pe_alloc, all);
--
2.14.2
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 1/3] powernv/pci: Delete an error message for a failed memory allocation in pnv_ioda_pick_m64
@ 2017-10-17 15:37 ` SF Markus Elfring
0 siblings, 0 replies; 16+ messages in thread
From: SF Markus Elfring @ 2017-10-17 15:37 UTC (permalink / raw)
To: linuxppc-dev, Alexey Kardashevskiy, Alistair Popple,
Benjamin Herrenschmidt, David Gibson, Gavin Shan,
Michael Ellerman, Paul Mackerras, Rob Herring, Russell Currey
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 17 Oct 2017 16:52:43 +0200
Omit an extra message for a memory allocation failure in this function.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
arch/powerpc/platforms/powernv/pci-ioda.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c
index fb5cd7511189..17c0330bb059 100644
--- a/arch/powerpc/platforms/powernv/pci-ioda.c
+++ b/arch/powerpc/platforms/powernv/pci-ioda.c
@@ -358,11 +358,8 @@ static struct pnv_ioda_pe *pnv_ioda_pick_m64_pe(struct pci_bus *bus, bool all)
/* Allocate bitmap */
size = _ALIGN_UP(phb->ioda.total_pe_num / 8, sizeof(unsigned long));
pe_alloc = kzalloc(size, GFP_KERNEL);
- if (!pe_alloc) {
- pr_warn("%s: Out of memory !\n",
- __func__);
+ if (!pe_alloc)
return NULL;
- }
/* Figure out reserved PE numbers by the PE */
pnv_ioda_reserve_m64_pe(bus, pe_alloc, all);
--
2.14.2
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 2/3] powernv/pci: Use common code in pnv_ioda_pick_m64_pe()
2017-10-17 15:35 ` SF Markus Elfring
@ 2017-10-17 15:39 ` SF Markus Elfring
-1 siblings, 0 replies; 16+ messages in thread
From: SF Markus Elfring @ 2017-10-17 15:39 UTC (permalink / raw)
To: linuxppc-dev, Alexey Kardashevskiy, Alistair Popple,
Benjamin Herrenschmidt, David Gibson, Gavin Shan,
Michael Ellerman, Paul Mackerras, Rob Herring, Russell Currey
Cc: LKML, kernel-janitors
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.
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;
}
--
2.14.2
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 2/3] powernv/pci: Use common code in pnv_ioda_pick_m64_pe()
@ 2017-10-17 15:39 ` SF Markus Elfring
0 siblings, 0 replies; 16+ messages in thread
From: SF Markus Elfring @ 2017-10-17 15:39 UTC (permalink / raw)
To: linuxppc-dev, Alexey Kardashevskiy, Alistair Popple,
Benjamin Herrenschmidt, David Gibson, Gavin Shan,
Michael Ellerman, Paul Mackerras, Rob Herring, Russell Currey
Cc: LKML, kernel-janitors
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.
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;
}
--
2.14.2
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 3/3] powernv/pci: Improve a size determination in pnv_pci_init_ioda_phb()
2017-10-17 15:35 ` SF Markus Elfring
@ 2017-10-17 15:40 ` SF Markus Elfring
-1 siblings, 0 replies; 16+ messages in thread
From: SF Markus Elfring @ 2017-10-17 15:40 UTC (permalink / raw)
To: linuxppc-dev, Alexey Kardashevskiy, Alistair Popple,
Benjamin Herrenschmidt, David Gibson, Gavin Shan,
Michael Ellerman, Paul Mackerras, Rob Herring, Russell Currey
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 17 Oct 2017 17:18:10 +0200
Replace the specification of a data structure by a pointer dereference
as the parameter for the operator "sizeof" to make the corresponding size
determination a bit safer according to the Linux coding style convention.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
arch/powerpc/platforms/powernv/pci-ioda.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c
index 98d9435240f4..2febdf06a237 100644
--- a/arch/powerpc/platforms/powernv/pci-ioda.c
+++ b/arch/powerpc/platforms/powernv/pci-ioda.c
@@ -3802,7 +3802,7 @@ static void __init pnv_pci_init_ioda_phb(struct device_node *np,
phb_id = be64_to_cpup(prop64);
pr_debug(" PHB-ID : 0x%016llx\n", phb_id);
- phb = memblock_virt_alloc(sizeof(struct pnv_phb), 0);
+ phb = memblock_virt_alloc(sizeof(*phb), 0);
/* Allocate PCI controller */
phb->hose = hose = pcibios_alloc_controller(np);
--
2.14.2
^ permalink raw reply related [flat|nested] 16+ messages in thread
* [PATCH 3/3] powernv/pci: Improve a size determination in pnv_pci_init_ioda_phb()
@ 2017-10-17 15:40 ` SF Markus Elfring
0 siblings, 0 replies; 16+ messages in thread
From: SF Markus Elfring @ 2017-10-17 15:40 UTC (permalink / raw)
To: linuxppc-dev, Alexey Kardashevskiy, Alistair Popple,
Benjamin Herrenschmidt, David Gibson, Gavin Shan,
Michael Ellerman, Paul Mackerras, Rob Herring, Russell Currey
Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 17 Oct 2017 17:18:10 +0200
Replace the specification of a data structure by a pointer dereference
as the parameter for the operator "sizeof" to make the corresponding size
determination a bit safer according to the Linux coding style convention.
This issue was detected by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
arch/powerpc/platforms/powernv/pci-ioda.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c
index 98d9435240f4..2febdf06a237 100644
--- a/arch/powerpc/platforms/powernv/pci-ioda.c
+++ b/arch/powerpc/platforms/powernv/pci-ioda.c
@@ -3802,7 +3802,7 @@ static void __init pnv_pci_init_ioda_phb(struct device_node *np,
phb_id = be64_to_cpup(prop64);
pr_debug(" PHB-ID : 0x%016llx\n", phb_id);
- phb = memblock_virt_alloc(sizeof(struct pnv_phb), 0);
+ phb = memblock_virt_alloc(sizeof(*phb), 0);
/* Allocate PCI controller */
phb->hose = hose = pcibios_alloc_controller(np);
--
2.14.2
^ permalink raw reply related [flat|nested] 16+ messages in thread
* Re: [PATCH 1/3] powernv/pci: Delete an error message for a failed memory allocation in pnv_ioda_pick_m64_pe()
2017-10-17 15:37 ` [PATCH 1/3] powernv/pci: Delete an error message for a failed memory allocation in pnv_ioda_pick_m64 SF Markus Elfring
@ 2017-10-18 5:21 ` Alexey Kardashevskiy
-1 siblings, 0 replies; 16+ messages in thread
From: Alexey Kardashevskiy @ 2017-10-18 5:21 UTC (permalink / raw)
To: SF Markus Elfring, linuxppc-dev, Alistair Popple,
Benjamin Herrenschmidt, David Gibson, Gavin Shan,
Michael Ellerman, Paul Mackerras, Rob Herring, Russell Currey
Cc: LKML, kernel-janitors
On 18/10/17 02:37, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Tue, 17 Oct 2017 16:52:43 +0200
>
> Omit an extra message for a memory allocation failure in this function.
>
> This issue was detected by using the Coccinelle software.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
> arch/powerpc/platforms/powernv/pci-ioda.c | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c
> index fb5cd7511189..17c0330bb059 100644
> --- a/arch/powerpc/platforms/powernv/pci-ioda.c
> +++ b/arch/powerpc/platforms/powernv/pci-ioda.c
> @@ -358,11 +358,8 @@ static struct pnv_ioda_pe *pnv_ioda_pick_m64_pe(struct pci_bus *bus, bool all)
> /* Allocate bitmap */
> size = _ALIGN_UP(phb->ioda.total_pe_num / 8, sizeof(unsigned long));
> pe_alloc = kzalloc(size, GFP_KERNEL);
> - if (!pe_alloc) {
> - pr_warn("%s: Out of memory !\n",
> - __func__);
> + if (!pe_alloc)
> return NULL;
> - }
>
> /* Figure out reserved PE numbers by the PE */
> pnv_ioda_reserve_m64_pe(bus, pe_alloc, all);
>
Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>
--
Alexey
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 1/3] powernv/pci: Delete an error message for a failed memory allocation in pnv_ioda_pick
@ 2017-10-18 5:21 ` Alexey Kardashevskiy
0 siblings, 0 replies; 16+ messages in thread
From: Alexey Kardashevskiy @ 2017-10-18 5:21 UTC (permalink / raw)
To: SF Markus Elfring, linuxppc-dev, Alistair Popple,
Benjamin Herrenschmidt, David Gibson, Gavin Shan,
Michael Ellerman, Paul Mackerras, Rob Herring, Russell Currey
Cc: LKML, kernel-janitors
On 18/10/17 02:37, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Tue, 17 Oct 2017 16:52:43 +0200
>
> Omit an extra message for a memory allocation failure in this function.
>
> This issue was detected by using the Coccinelle software.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
> arch/powerpc/platforms/powernv/pci-ioda.c | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c
> index fb5cd7511189..17c0330bb059 100644
> --- a/arch/powerpc/platforms/powernv/pci-ioda.c
> +++ b/arch/powerpc/platforms/powernv/pci-ioda.c
> @@ -358,11 +358,8 @@ static struct pnv_ioda_pe *pnv_ioda_pick_m64_pe(struct pci_bus *bus, bool all)
> /* Allocate bitmap */
> size = _ALIGN_UP(phb->ioda.total_pe_num / 8, sizeof(unsigned long));
> pe_alloc = kzalloc(size, GFP_KERNEL);
> - if (!pe_alloc) {
> - pr_warn("%s: Out of memory !\n",
> - __func__);
> + if (!pe_alloc)
> return NULL;
> - }
>
> /* Figure out reserved PE numbers by the PE */
> pnv_ioda_reserve_m64_pe(bus, pe_alloc, all);
>
Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>
--
Alexey
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 3/3] powernv/pci: Improve a size determination in pnv_pci_init_ioda_phb()
2017-10-17 15:40 ` SF Markus Elfring
@ 2017-10-18 5:21 ` Alexey Kardashevskiy
-1 siblings, 0 replies; 16+ messages in thread
From: Alexey Kardashevskiy @ 2017-10-18 5:21 UTC (permalink / raw)
To: SF Markus Elfring, linuxppc-dev, Alistair Popple,
Benjamin Herrenschmidt, David Gibson, Gavin Shan,
Michael Ellerman, Paul Mackerras, Rob Herring, Russell Currey
Cc: LKML, kernel-janitors
On 18/10/17 02:40, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Tue, 17 Oct 2017 17:18:10 +0200
>
> Replace the specification of a data structure by a pointer dereference
> as the parameter for the operator "sizeof" to make the corresponding size
> determination a bit safer according to the Linux coding style convention.
>
> This issue was detected by using the Coccinelle software.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
> arch/powerpc/platforms/powernv/pci-ioda.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c
> index 98d9435240f4..2febdf06a237 100644
> --- a/arch/powerpc/platforms/powernv/pci-ioda.c
> +++ b/arch/powerpc/platforms/powernv/pci-ioda.c
> @@ -3802,7 +3802,7 @@ static void __init pnv_pci_init_ioda_phb(struct device_node *np,
> phb_id = be64_to_cpup(prop64);
> pr_debug(" PHB-ID : 0x%016llx\n", phb_id);
>
> - phb = memblock_virt_alloc(sizeof(struct pnv_phb), 0);
> + phb = memblock_virt_alloc(sizeof(*phb), 0);
>
> /* Allocate PCI controller */
> phb->hose = hose = pcibios_alloc_controller(np);
>
Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>
--
Alexey
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 3/3] powernv/pci: Improve a size determination in pnv_pci_init_ioda_phb()
@ 2017-10-18 5:21 ` Alexey Kardashevskiy
0 siblings, 0 replies; 16+ messages in thread
From: Alexey Kardashevskiy @ 2017-10-18 5:21 UTC (permalink / raw)
To: SF Markus Elfring, linuxppc-dev, Alistair Popple,
Benjamin Herrenschmidt, David Gibson, Gavin Shan,
Michael Ellerman, Paul Mackerras, Rob Herring, Russell Currey
Cc: LKML, kernel-janitors
On 18/10/17 02:40, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Tue, 17 Oct 2017 17:18:10 +0200
>
> Replace the specification of a data structure by a pointer dereference
> as the parameter for the operator "sizeof" to make the corresponding size
> determination a bit safer according to the Linux coding style convention.
>
> This issue was detected by using the Coccinelle software.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> ---
> arch/powerpc/platforms/powernv/pci-ioda.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c
> index 98d9435240f4..2febdf06a237 100644
> --- a/arch/powerpc/platforms/powernv/pci-ioda.c
> +++ b/arch/powerpc/platforms/powernv/pci-ioda.c
> @@ -3802,7 +3802,7 @@ static void __init pnv_pci_init_ioda_phb(struct device_node *np,
> phb_id = be64_to_cpup(prop64);
> pr_debug(" PHB-ID : 0x%016llx\n", phb_id);
>
> - phb = memblock_virt_alloc(sizeof(struct pnv_phb), 0);
> + phb = memblock_virt_alloc(sizeof(*phb), 0);
>
> /* Allocate PCI controller */
> phb->hose = hose = pcibios_alloc_controller(np);
>
Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>
--
Alexey
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 2/3] powernv/pci: Use common code in pnv_ioda_pick_m64_pe()
2017-10-17 15:39 ` SF Markus Elfring
@ 2017-10-18 5:24 ` Alexey Kardashevskiy
-1 siblings, 0 replies; 16+ messages in thread
From: Alexey Kardashevskiy @ 2017-10-18 5:24 UTC (permalink / raw)
To: SF Markus Elfring, linuxppc-dev, Alistair Popple,
Benjamin Herrenschmidt, David Gibson, Gavin Shan,
Michael Ellerman, Paul Mackerras, Rob Herring, Russell Currey
Cc: LKML, kernel-janitors
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
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [PATCH 2/3] powernv/pci: Use common code in pnv_ioda_pick_m64_pe()
@ 2017-10-18 5:24 ` Alexey Kardashevskiy
0 siblings, 0 replies; 16+ messages in thread
From: Alexey Kardashevskiy @ 2017-10-18 5:24 UTC (permalink / raw)
To: SF Markus Elfring, linuxppc-dev, Alistair Popple,
Benjamin Herrenschmidt, David Gibson, Gavin Shan,
Michael Ellerman, Paul Mackerras, Rob Herring, Russell Currey
Cc: LKML, kernel-janitors
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
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [3/3] powernv/pci: Improve a size determination in pnv_pci_init_ioda_phb()
2017-10-17 15:40 ` SF Markus Elfring
@ 2018-03-20 10:15 ` Michael Ellerman
-1 siblings, 0 replies; 16+ messages in thread
From: Michael Ellerman @ 2018-03-20 10:15 UTC (permalink / raw)
To: SF Markus Elfring, linuxppc-dev, Alexey Kardashevskiy,
Alistair Popple, Benjamin Herrenschmidt, David Gibson,
Gavin Shan, Paul Mackerras, Rob Herring, Russell Currey
Cc: kernel-janitors, LKML
On Tue, 2017-10-17 at 15:40:17 UTC, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Tue, 17 Oct 2017 17:18:10 +0200
>
> Replace the specification of a data structure by a pointer dereference
> as the parameter for the operator "sizeof" to make the corresponding size
> determination a bit safer according to the Linux coding style convention.
>
> This issue was detected by using the Coccinelle software.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Applied to powerpc next, thanks.
https://git.kernel.org/powerpc/c/a0828cf57acce9bf941539e1f633e9
cheers
^ permalink raw reply [flat|nested] 16+ messages in thread
* Re: [3/3] powernv/pci: Improve a size determination in pnv_pci_init_ioda_phb()
@ 2018-03-20 10:15 ` Michael Ellerman
0 siblings, 0 replies; 16+ messages in thread
From: Michael Ellerman @ 2018-03-20 10:15 UTC (permalink / raw)
To: SF Markus Elfring, linuxppc-dev, Alexey Kardashevskiy,
Alistair Popple, Benjamin Herrenschmidt, David Gibson,
Gavin Shan, Paul Mackerras, Rob Herring, Russell Currey
Cc: kernel-janitors, LKML
On Tue, 2017-10-17 at 15:40:17 UTC, SF Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Tue, 17 Oct 2017 17:18:10 +0200
>
> Replace the specification of a data structure by a pointer dereference
> as the parameter for the operator "sizeof" to make the corresponding size
> determination a bit safer according to the Linux coding style convention.
>
> This issue was detected by using the Coccinelle software.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Applied to powerpc next, thanks.
https://git.kernel.org/powerpc/c/a0828cf57acce9bf941539e1f633e9
cheers
^ permalink raw reply [flat|nested] 16+ messages in thread
end of thread, other threads:[~2018-03-20 10:15 UTC | newest]
Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-17 15:35 [PATCH 0/3] PowerNV-PCI: Adjustments for two function implementations SF Markus Elfring
2017-10-17 15:35 ` SF Markus Elfring
2017-10-17 15:37 ` [PATCH 1/3] powernv/pci: Delete an error message for a failed memory allocation in pnv_ioda_pick_m64_pe() SF Markus Elfring
2017-10-17 15:37 ` [PATCH 1/3] powernv/pci: Delete an error message for a failed memory allocation in pnv_ioda_pick_m64 SF Markus Elfring
2017-10-18 5:21 ` [PATCH 1/3] powernv/pci: Delete an error message for a failed memory allocation in pnv_ioda_pick_m64_pe() Alexey Kardashevskiy
2017-10-18 5:21 ` [PATCH 1/3] powernv/pci: Delete an error message for a failed memory allocation in pnv_ioda_pick Alexey Kardashevskiy
2017-10-17 15:39 ` [PATCH 2/3] powernv/pci: Use common code in pnv_ioda_pick_m64_pe() SF Markus Elfring
2017-10-17 15:39 ` SF Markus Elfring
2017-10-18 5:24 ` Alexey Kardashevskiy
2017-10-18 5:24 ` Alexey Kardashevskiy
2017-10-17 15:40 ` [PATCH 3/3] powernv/pci: Improve a size determination in pnv_pci_init_ioda_phb() SF Markus Elfring
2017-10-17 15:40 ` SF Markus Elfring
2017-10-18 5:21 ` Alexey Kardashevskiy
2017-10-18 5:21 ` Alexey Kardashevskiy
2018-03-20 10:15 ` [3/3] " Michael Ellerman
2018-03-20 10:15 ` Michael Ellerman
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.