* [PATCH -next] powerpc/pseries/memory-hotplug: Fix return value type of find_aa_index
@ 2018-09-21 10:37 YueHaibing
2018-09-28 20:25 ` Nathan Fontenot
0 siblings, 1 reply; 2+ messages in thread
From: YueHaibing @ 2018-09-21 10:37 UTC (permalink / raw)
To: benh, paulus, mpe, nfont; +Cc: linux-kernel, linuxppc-dev, YueHaibing
find_aa_index will return -1 when dlpar_clone_property fails,
its return value type should be int. Also the caller
update_lmb_associativity_index should use a int variable to
get it,then compared with 0.
Fixes: c05a5a40969e ("powerpc/pseries: Dynamic add entires to associativity lookup array")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
arch/powerpc/platforms/pseries/hotplug-memory.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/arch/powerpc/platforms/pseries/hotplug-memory.c b/arch/powerpc/platforms/pseries/hotplug-memory.c
index 9a15d39..6aad17c 100644
--- a/arch/powerpc/platforms/pseries/hotplug-memory.c
+++ b/arch/powerpc/platforms/pseries/hotplug-memory.c
@@ -101,13 +101,12 @@ static struct property *dlpar_clone_property(struct property *prop,
return new_prop;
}
-static u32 find_aa_index(struct device_node *dr_node,
+static int find_aa_index(struct device_node *dr_node,
struct property *ala_prop, const u32 *lmb_assoc)
{
u32 *assoc_arrays;
- u32 aa_index;
int aa_arrays, aa_array_entries, aa_array_sz;
- int i, index;
+ int i, index, aa_index;
/*
* The ibm,associativity-lookup-arrays property is defined to be
@@ -168,7 +167,7 @@ static int update_lmb_associativity_index(struct drmem_lmb *lmb)
struct device_node *parent, *lmb_node, *dr_node;
struct property *ala_prop;
const u32 *lmb_assoc;
- u32 aa_index;
+ int aa_index;
parent = of_find_node_by_path("/");
if (!parent)
--
2.7.0
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH -next] powerpc/pseries/memory-hotplug: Fix return value type of find_aa_index
2018-09-21 10:37 [PATCH -next] powerpc/pseries/memory-hotplug: Fix return value type of find_aa_index YueHaibing
@ 2018-09-28 20:25 ` Nathan Fontenot
0 siblings, 0 replies; 2+ messages in thread
From: Nathan Fontenot @ 2018-09-28 20:25 UTC (permalink / raw)
To: YueHaibing, benh, paulus, mpe; +Cc: linuxppc-dev, linux-kernel
On 09/21/2018 05:37 AM, YueHaibing wrote:
> find_aa_index will return -1 when dlpar_clone_property fails,
> its return value type should be int. Also the caller
> update_lmb_associativity_index should use a int variable to
> get it,then compared with 0.
The aa_index that we are handling here is defined as an unsigned value
in the PAPR so I'm a little hesitant in changing it to a signed value.
Also, changing the aa_index to be signed, we still assign it to the
u32 lmb->aa_index.
There are some other places where the aa_index is treated as a signed value
in finc_aa_index(). Perhaps the better solution is use an rc value to track
the validation of finding the aa_index instead of the aa_index value itself.
-Nathan
>
> Fixes: c05a5a40969e ("powerpc/pseries: Dynamic add entires to associativity lookup array")
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> ---
> arch/powerpc/platforms/pseries/hotplug-memory.c | 7 +++----
> 1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/arch/powerpc/platforms/pseries/hotplug-memory.c b/arch/powerpc/platforms/pseries/hotplug-memory.c
> index 9a15d39..6aad17c 100644
> --- a/arch/powerpc/platforms/pseries/hotplug-memory.c
> +++ b/arch/powerpc/platforms/pseries/hotplug-memory.c
> @@ -101,13 +101,12 @@ static struct property *dlpar_clone_property(struct property *prop,
> return new_prop;
> }
>
> -static u32 find_aa_index(struct device_node *dr_node,
> +static int find_aa_index(struct device_node *dr_node,
> struct property *ala_prop, const u32 *lmb_assoc)
> {
> u32 *assoc_arrays;
> - u32 aa_index;
> int aa_arrays, aa_array_entries, aa_array_sz;
> - int i, index;
> + int i, index, aa_index;
>
> /*
> * The ibm,associativity-lookup-arrays property is defined to be
> @@ -168,7 +167,7 @@ static int update_lmb_associativity_index(struct drmem_lmb *lmb)
> struct device_node *parent, *lmb_node, *dr_node;
> struct property *ala_prop;
> const u32 *lmb_assoc;
> - u32 aa_index;
> + int aa_index;
>
> parent = of_find_node_by_path("/");
> if (!parent)
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-09-28 20:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-09-21 10:37 [PATCH -next] powerpc/pseries/memory-hotplug: Fix return value type of find_aa_index YueHaibing
2018-09-28 20:25 ` Nathan Fontenot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox