|
@@ -466,19 +466,27 @@ struct assoc_arrays {
|
|
|
* indicating the size of each associativity array, followed by a list
|
|
|
* of N associativity arrays.
|
|
|
*/
|
|
|
-static int of_get_assoc_arrays(struct device_node *memory,
|
|
|
- struct assoc_arrays *aa)
|
|
|
+static int of_get_assoc_arrays(struct assoc_arrays *aa)
|
|
|
{
|
|
|
+ struct device_node *memory;
|
|
|
const __be32 *prop;
|
|
|
u32 len;
|
|
|
|
|
|
+ memory = of_find_node_by_path("/ibm,dynamic-reconfiguration-memory");
|
|
|
+ if (!memory)
|
|
|
+ return -1;
|
|
|
+
|
|
|
prop = of_get_property(memory, "ibm,associativity-lookup-arrays", &len);
|
|
|
- if (!prop || len < 2 * sizeof(unsigned int))
|
|
|
+ if (!prop || len < 2 * sizeof(unsigned int)) {
|
|
|
+ of_node_put(memory);
|
|
|
return -1;
|
|
|
+ }
|
|
|
|
|
|
aa->n_arrays = of_read_number(prop++, 1);
|
|
|
aa->array_sz = of_read_number(prop++, 1);
|
|
|
|
|
|
+ of_node_put(memory);
|
|
|
+
|
|
|
/* Now that we know the number of arrays and size of each array,
|
|
|
* revalidate the size of the property read in.
|
|
|
*/
|
|
@@ -661,7 +669,7 @@ static void __init parse_drconf_memory(struct device_node *memory)
|
|
|
if (!lmb_size)
|
|
|
return;
|
|
|
|
|
|
- rc = of_get_assoc_arrays(memory, &aa);
|
|
|
+ rc = of_get_assoc_arrays(&aa);
|
|
|
if (rc)
|
|
|
return;
|
|
|
|
|
@@ -996,7 +1004,7 @@ static int hot_add_drconf_scn_to_nid(struct device_node *memory,
|
|
|
if (!lmb_size)
|
|
|
return -1;
|
|
|
|
|
|
- rc = of_get_assoc_arrays(memory, &aa);
|
|
|
+ rc = of_get_assoc_arrays(&aa);
|
|
|
if (rc)
|
|
|
return -1;
|
|
|
|