Message ID | 1438187064-7244-1-git-send-email-chris.j.arges@canonical.com |
---|---|
State | New |
Headers | show |
On Wed, Jul 29, 2015 at 11:24:24AM -0500, Chris J Arges wrote: > From: Joel Stanley <joel@jms.id.au> > > BugLink: http://bugs.launchpad.net/bugs/1478513 > > 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 <joel@jms.id.au> > Acked-by: Neelesh Gupta <neelegup@linux.vnet.ibm.com> > Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> > (cherry picked from commit 38c0488770983b2654f075540cc1fc71f55b6df5) > Signed-off-by: Chris J Arges <chris.j.arges@canonical.com> > --- > arch/powerpc/platforms/powernv/opal-sysparam.c | 31 +++++++++++++------------- > 1 file changed, 15 insertions(+), 16 deletions(-) > > diff --git a/arch/powerpc/platforms/powernv/opal-sysparam.c b/arch/powerpc/platforms/powernv/opal-sysparam.c > index 9d1acf2..2e52b47 100644 > --- a/arch/powerpc/platforms/powernv/opal-sysparam.c > +++ b/arch/powerpc/platforms/powernv/opal-sysparam.c > @@ -162,10 +162,20 @@ void __init opal_sys_param_init(void) > goto out; > } > > + /* Some systems do not use sysparams; this is not an error */ > + sysparam = of_find_node_by_path("/ibm,opal/sysparams"); > + if (!sysparam) > + goto out; > + > + if (!of_device_is_compatible(sysparam, "ibm,opal-sysparams")) { > + pr_err("SYSPARAM: Opal sysparam node not compatible\n"); > + goto out_node_put; > + } > + > sysparam_kobj = kobject_create_and_add("sysparams", opal_kobj); > if (!sysparam_kobj) { > pr_err("SYSPARAM: Failed to create sysparam kobject\n"); > - goto out; > + goto out_node_put; > } > > /* Allocate big enough buffer for any get/set transactions */ > @@ -176,30 +186,19 @@ void __init opal_sys_param_init(void) > goto out_kobj_put; > } > > - sysparam = of_find_node_by_path("/ibm,opal/sysparams"); > - if (!sysparam) { > - pr_err("SYSPARAM: Opal sysparam node not found\n"); > - goto out_param_buf; > - } > - > - if (!of_device_is_compatible(sysparam, "ibm,opal-sysparams")) { > - pr_err("SYSPARAM: Opal sysparam node not compatible\n"); > - goto out_node_put; > - } > - > /* Number of parameters exposed through DT */ > count = of_property_count_strings(sysparam, "param-name"); > if (count < 0) { > pr_err("SYSPARAM: No string found of property param-name in " > "the node %s\n", sysparam->name); > - goto out_node_put; > + goto out_param_buf; > } > > id = kzalloc(sizeof(*id) * count, GFP_KERNEL); > if (!id) { > pr_err("SYSPARAM: Failed to allocate memory to read parameter " > "id\n"); > - goto out_node_put; > + goto out_param_buf; > } > > size = kzalloc(sizeof(*size) * count, GFP_KERNEL); > @@ -293,12 +292,12 @@ out_free_size: > kfree(size); > out_free_id: > kfree(id); > -out_node_put: > - of_node_put(sysparam); > out_param_buf: > kfree(param_data_buf); > out_kobj_put: > kobject_put(sysparam_kobj); > +out_node_put: > + of_node_put(sysparam); > out: > return; > } Looks to do what is claimed. Though it is not entirely clear that saving a message is that important? Other than that: Acked-by: Andy Whitcroft <apw@canonical.com> -apw
On Wed, Jul 29, 2015 at 11:24:24AM -0500, Chris J Arges wrote: > From: Joel Stanley <joel@jms.id.au> > > BugLink: http://bugs.launchpad.net/bugs/1478513 > > 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 <joel@jms.id.au> > Acked-by: Neelesh Gupta <neelegup@linux.vnet.ibm.com> > Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> > (cherry picked from commit 38c0488770983b2654f075540cc1fc71f55b6df5) > Signed-off-by: Chris J Arges <chris.j.arges@canonical.com> > --- > arch/powerpc/platforms/powernv/opal-sysparam.c | 31 +++++++++++++------------- > 1 file changed, 15 insertions(+), 16 deletions(-) > > diff --git a/arch/powerpc/platforms/powernv/opal-sysparam.c b/arch/powerpc/platforms/powernv/opal-sysparam.c > index 9d1acf2..2e52b47 100644 > --- a/arch/powerpc/platforms/powernv/opal-sysparam.c > +++ b/arch/powerpc/platforms/powernv/opal-sysparam.c > @@ -162,10 +162,20 @@ void __init opal_sys_param_init(void) > goto out; > } > > + /* Some systems do not use sysparams; this is not an error */ > + sysparam = of_find_node_by_path("/ibm,opal/sysparams"); > + if (!sysparam) > + goto out; > + > + if (!of_device_is_compatible(sysparam, "ibm,opal-sysparams")) { > + pr_err("SYSPARAM: Opal sysparam node not compatible\n"); > + goto out_node_put; > + } > + > sysparam_kobj = kobject_create_and_add("sysparams", opal_kobj); > if (!sysparam_kobj) { > pr_err("SYSPARAM: Failed to create sysparam kobject\n"); > - goto out; > + goto out_node_put; > } > > /* Allocate big enough buffer for any get/set transactions */ > @@ -176,30 +186,19 @@ void __init opal_sys_param_init(void) > goto out_kobj_put; > } > > - sysparam = of_find_node_by_path("/ibm,opal/sysparams"); > - if (!sysparam) { > - pr_err("SYSPARAM: Opal sysparam node not found\n"); > - goto out_param_buf; > - } > - > - if (!of_device_is_compatible(sysparam, "ibm,opal-sysparams")) { > - pr_err("SYSPARAM: Opal sysparam node not compatible\n"); > - goto out_node_put; > - } > - > /* Number of parameters exposed through DT */ > count = of_property_count_strings(sysparam, "param-name"); > if (count < 0) { > pr_err("SYSPARAM: No string found of property param-name in " > "the node %s\n", sysparam->name); > - goto out_node_put; > + goto out_param_buf; > } > > id = kzalloc(sizeof(*id) * count, GFP_KERNEL); > if (!id) { > pr_err("SYSPARAM: Failed to allocate memory to read parameter " > "id\n"); > - goto out_node_put; > + goto out_param_buf; > } > > size = kzalloc(sizeof(*size) * count, GFP_KERNEL); > @@ -293,12 +292,12 @@ out_free_size: > kfree(size); > out_free_id: > kfree(id); > -out_node_put: > - of_node_put(sysparam); > out_param_buf: > kfree(param_data_buf); > out_kobj_put: > kobject_put(sysparam_kobj); > +out_node_put: > + of_node_put(sysparam); > out: > return; > } > -- > 1.9.1 > > > -- > kernel-team mailing list > kernel-team@lists.ubuntu.com > https://lists.ubuntu.com/mailman/listinfo/kernel-team
Applied to the master-next branch of Vivid.
diff --git a/arch/powerpc/platforms/powernv/opal-sysparam.c b/arch/powerpc/platforms/powernv/opal-sysparam.c index 9d1acf2..2e52b47 100644 --- a/arch/powerpc/platforms/powernv/opal-sysparam.c +++ b/arch/powerpc/platforms/powernv/opal-sysparam.c @@ -162,10 +162,20 @@ void __init opal_sys_param_init(void) goto out; } + /* Some systems do not use sysparams; this is not an error */ + sysparam = of_find_node_by_path("/ibm,opal/sysparams"); + if (!sysparam) + goto out; + + if (!of_device_is_compatible(sysparam, "ibm,opal-sysparams")) { + pr_err("SYSPARAM: Opal sysparam node not compatible\n"); + goto out_node_put; + } + sysparam_kobj = kobject_create_and_add("sysparams", opal_kobj); if (!sysparam_kobj) { pr_err("SYSPARAM: Failed to create sysparam kobject\n"); - goto out; + goto out_node_put; } /* Allocate big enough buffer for any get/set transactions */ @@ -176,30 +186,19 @@ void __init opal_sys_param_init(void) goto out_kobj_put; } - sysparam = of_find_node_by_path("/ibm,opal/sysparams"); - if (!sysparam) { - pr_err("SYSPARAM: Opal sysparam node not found\n"); - goto out_param_buf; - } - - if (!of_device_is_compatible(sysparam, "ibm,opal-sysparams")) { - pr_err("SYSPARAM: Opal sysparam node not compatible\n"); - goto out_node_put; - } - /* Number of parameters exposed through DT */ count = of_property_count_strings(sysparam, "param-name"); if (count < 0) { pr_err("SYSPARAM: No string found of property param-name in " "the node %s\n", sysparam->name); - goto out_node_put; + goto out_param_buf; } id = kzalloc(sizeof(*id) * count, GFP_KERNEL); if (!id) { pr_err("SYSPARAM: Failed to allocate memory to read parameter " "id\n"); - goto out_node_put; + goto out_param_buf; } size = kzalloc(sizeof(*size) * count, GFP_KERNEL); @@ -293,12 +292,12 @@ out_free_size: kfree(size); out_free_id: kfree(id); -out_node_put: - of_node_put(sysparam); out_param_buf: kfree(param_data_buf); out_kobj_put: kobject_put(sysparam_kobj); +out_node_put: + of_node_put(sysparam); out: return; }