Skip to content

Commit d0ff068

Browse files
committed
powerpc/powernv: Silence SYSPARAM warning on boot
OpenPower BMC machines do not place any sysparams in the device tree, so at every boot we get a warning: [ 0.437176] SYSPARAM: Opal sysparam node not found Remove the warning, and reorder the init so we don't peform allocations when there is no sysparam node in the device tree. Signed-off-by: Joel Stanley <[email protected]>
1 parent 7b29516 commit d0ff068

File tree

1 file changed

+15
-16
lines changed

1 file changed

+15
-16
lines changed

arch/powerpc/platforms/powernv/opal-sysparam.c

+15-16
Original file line numberDiff line numberDiff line change
@@ -162,10 +162,20 @@ void __init opal_sys_param_init(void)
162162
goto out;
163163
}
164164

165+
/* Some systems do not use sysparams; this is not an error */
166+
sysparam = of_find_node_by_path("/ibm,opal/sysparams");
167+
if (!sysparam)
168+
goto out;
169+
170+
if (!of_device_is_compatible(sysparam, "ibm,opal-sysparams")) {
171+
pr_err("SYSPARAM: Opal sysparam node not compatible\n");
172+
goto out_node_put;
173+
}
174+
165175
sysparam_kobj = kobject_create_and_add("sysparams", opal_kobj);
166176
if (!sysparam_kobj) {
167177
pr_err("SYSPARAM: Failed to create sysparam kobject\n");
168-
goto out;
178+
goto out_node_put;
169179
}
170180

171181
/* Allocate big enough buffer for any get/set transactions */
@@ -176,30 +186,19 @@ void __init opal_sys_param_init(void)
176186
goto out_kobj_put;
177187
}
178188

179-
sysparam = of_find_node_by_path("/ibm,opal/sysparams");
180-
if (!sysparam) {
181-
pr_err("SYSPARAM: Opal sysparam node not found\n");
182-
goto out_param_buf;
183-
}
184-
185-
if (!of_device_is_compatible(sysparam, "ibm,opal-sysparams")) {
186-
pr_err("SYSPARAM: Opal sysparam node not compatible\n");
187-
goto out_node_put;
188-
}
189-
190189
/* Number of parameters exposed through DT */
191190
count = of_property_count_strings(sysparam, "param-name");
192191
if (count < 0) {
193192
pr_err("SYSPARAM: No string found of property param-name in "
194193
"the node %s\n", sysparam->name);
195-
goto out_node_put;
194+
goto out_param_buf;
196195
}
197196

198197
id = kzalloc(sizeof(*id) * count, GFP_KERNEL);
199198
if (!id) {
200199
pr_err("SYSPARAM: Failed to allocate memory to read parameter "
201200
"id\n");
202-
goto out_node_put;
201+
goto out_param_buf;
203202
}
204203

205204
size = kzalloc(sizeof(*size) * count, GFP_KERNEL);
@@ -293,12 +292,12 @@ void __init opal_sys_param_init(void)
293292
kfree(size);
294293
out_free_id:
295294
kfree(id);
296-
out_node_put:
297-
of_node_put(sysparam);
298295
out_param_buf:
299296
kfree(param_data_buf);
300297
out_kobj_put:
301298
kobject_put(sysparam_kobj);
299+
out_node_put:
300+
of_node_put(sysparam);
302301
out:
303302
return;
304303
}

0 commit comments

Comments
 (0)