Commit de2780a3 authored by Akinobu Mita's avatar Akinobu Mita Committed by Benjamin Herrenschmidt

powerpc/pseries: Improve error code on reconfiguration notifier failure

Reconfiguration notifier call for device node may fail by several reasons,
but it always assumes kmalloc failures.

This enables reconfiguration notifier call chain to get the actual error
code rather than -ENOMEM by converting all reconfiguration notifier calls
to return encapsulate error code with notifier_from_errno().
Signed-off-by: default avatarAkinobu Mita <akinobu.mita@gmail.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: linuxppc-dev@lists.ozlabs.org
Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
parent 3aef19f0
......@@ -849,16 +849,14 @@ static int prom_reconfig_notifier(struct notifier_block *nb,
switch (action) {
case PSERIES_RECONFIG_ADD:
err = of_finish_dynamic_node(node);
if (err < 0) {
if (err < 0)
printk(KERN_ERR "finish_node returned %d\n", err);
err = NOTIFY_BAD;
}
break;
default:
err = NOTIFY_DONE;
err = 0;
break;
}
return err;
return notifier_from_errno(err);
}
static struct notifier_block prom_reconfig_nb = {
......
......@@ -330,21 +330,17 @@ static void pseries_remove_processor(struct device_node *np)
static int pseries_smp_notifier(struct notifier_block *nb,
unsigned long action, void *node)
{
int err = NOTIFY_OK;
int err = 0;
switch (action) {
case PSERIES_RECONFIG_ADD:
if (pseries_add_processor(node))
err = NOTIFY_BAD;
err = pseries_add_processor(node);
break;
case PSERIES_RECONFIG_REMOVE:
pseries_remove_processor(node);
break;
default:
err = NOTIFY_DONE;
break;
}
return err;
return notifier_from_errno(err);
}
static struct notifier_block pseries_smp_nb = {
......
......@@ -197,27 +197,21 @@ static int pseries_drconf_memory(unsigned long *base, unsigned int action)
static int pseries_memory_notifier(struct notifier_block *nb,
unsigned long action, void *node)
{
int err = NOTIFY_OK;
int err = 0;
switch (action) {
case PSERIES_RECONFIG_ADD:
if (pseries_add_memory(node))
err = NOTIFY_BAD;
err = pseries_add_memory(node);
break;
case PSERIES_RECONFIG_REMOVE:
if (pseries_remove_memory(node))
err = NOTIFY_BAD;
err = pseries_remove_memory(node);
break;
case PSERIES_DRCONF_MEM_ADD:
case PSERIES_DRCONF_MEM_REMOVE:
if (pseries_drconf_memory(node, action))
err = NOTIFY_BAD;
break;
default:
err = NOTIFY_DONE;
err = pseries_drconf_memory(node, action);
break;
}
return err;
return notifier_from_errno(err);
}
static struct notifier_block pseries_mem_nb = {
......
......@@ -114,9 +114,7 @@ int pSeries_reconfig_notify(unsigned long action, void *p)
int err = blocking_notifier_call_chain(&pSeries_reconfig_chain,
action, p);
if (err == NOTIFY_BAD)
return -ENOMEM; /* For now, safe to assume kmalloc failure */
return 0;
return notifier_to_errno(err);
}
static int pSeries_reconfig_add_node(const char *path, struct property *proplist)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment