aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorAkinobu Mita <akinobu.mita@gmail.com>2011-06-20 23:35:56 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2011-06-29 03:48:24 -0400
commitde2780a3d82372a6bfc7f474905e346c0f26dfa4 (patch)
treef9a50e6dadeeacfad6d6c8f266d98662679b5dd0 /arch
parent3aef19f0a10d1c274a15191766b627fe550d456e (diff)
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: Akinobu 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: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/powerpc/kernel/prom.c8
-rw-r--r--arch/powerpc/platforms/pseries/hotplug-cpu.c10
-rw-r--r--arch/powerpc/platforms/pseries/hotplug-memory.c16
-rw-r--r--arch/powerpc/platforms/pseries/reconfig.c4
4 files changed, 12 insertions, 26 deletions
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 534c50359e06..b8e6189298f4 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -849,16 +849,14 @@ static int prom_reconfig_notifier(struct notifier_block *nb,
849 switch (action) { 849 switch (action) {
850 case PSERIES_RECONFIG_ADD: 850 case PSERIES_RECONFIG_ADD:
851 err = of_finish_dynamic_node(node); 851 err = of_finish_dynamic_node(node);
852 if (err < 0) { 852 if (err < 0)
853 printk(KERN_ERR "finish_node returned %d\n", err); 853 printk(KERN_ERR "finish_node returned %d\n", err);
854 err = NOTIFY_BAD;
855 }
856 break; 854 break;
857 default: 855 default:
858 err = NOTIFY_DONE; 856 err = 0;
859 break; 857 break;
860 } 858 }
861 return err; 859 return notifier_from_errno(err);
862} 860}
863 861
864static struct notifier_block prom_reconfig_nb = { 862static struct notifier_block prom_reconfig_nb = {
diff --git a/arch/powerpc/platforms/pseries/hotplug-cpu.c b/arch/powerpc/platforms/pseries/hotplug-cpu.c
index 46f13a3c5d09..bc0288501f17 100644
--- a/arch/powerpc/platforms/pseries/hotplug-cpu.c
+++ b/arch/powerpc/platforms/pseries/hotplug-cpu.c
@@ -330,21 +330,17 @@ static void pseries_remove_processor(struct device_node *np)
330static int pseries_smp_notifier(struct notifier_block *nb, 330static int pseries_smp_notifier(struct notifier_block *nb,
331 unsigned long action, void *node) 331 unsigned long action, void *node)
332{ 332{
333 int err = NOTIFY_OK; 333 int err = 0;
334 334
335 switch (action) { 335 switch (action) {
336 case PSERIES_RECONFIG_ADD: 336 case PSERIES_RECONFIG_ADD:
337 if (pseries_add_processor(node)) 337 err = pseries_add_processor(node);
338 err = NOTIFY_BAD;
339 break; 338 break;
340 case PSERIES_RECONFIG_REMOVE: 339 case PSERIES_RECONFIG_REMOVE:
341 pseries_remove_processor(node); 340 pseries_remove_processor(node);
342 break; 341 break;
343 default:
344 err = NOTIFY_DONE;
345 break;
346 } 342 }
347 return err; 343 return notifier_from_errno(err);
348} 344}
349 345
350static struct notifier_block pseries_smp_nb = { 346static struct notifier_block pseries_smp_nb = {
diff --git a/arch/powerpc/platforms/pseries/hotplug-memory.c b/arch/powerpc/platforms/pseries/hotplug-memory.c
index 33867ec4a234..1eaefd661d36 100644
--- a/arch/powerpc/platforms/pseries/hotplug-memory.c
+++ b/arch/powerpc/platforms/pseries/hotplug-memory.c
@@ -197,27 +197,21 @@ static int pseries_drconf_memory(unsigned long *base, unsigned int action)
197static int pseries_memory_notifier(struct notifier_block *nb, 197static int pseries_memory_notifier(struct notifier_block *nb,
198 unsigned long action, void *node) 198 unsigned long action, void *node)
199{ 199{
200 int err = NOTIFY_OK; 200 int err = 0;
201 201
202 switch (action) { 202 switch (action) {
203 case PSERIES_RECONFIG_ADD: 203 case PSERIES_RECONFIG_ADD:
204 if (pseries_add_memory(node)) 204 err = pseries_add_memory(node);
205 err = NOTIFY_BAD;
206 break; 205 break;
207 case PSERIES_RECONFIG_REMOVE: 206 case PSERIES_RECONFIG_REMOVE:
208 if (pseries_remove_memory(node)) 207 err = pseries_remove_memory(node);
209 err = NOTIFY_BAD;
210 break; 208 break;
211 case PSERIES_DRCONF_MEM_ADD: 209 case PSERIES_DRCONF_MEM_ADD:
212 case PSERIES_DRCONF_MEM_REMOVE: 210 case PSERIES_DRCONF_MEM_REMOVE:
213 if (pseries_drconf_memory(node, action)) 211 err = pseries_drconf_memory(node, action);
214 err = NOTIFY_BAD;
215 break;
216 default:
217 err = NOTIFY_DONE;
218 break; 212 break;
219 } 213 }
220 return err; 214 return notifier_from_errno(err);
221} 215}
222 216
223static struct notifier_block pseries_mem_nb = { 217static struct notifier_block pseries_mem_nb = {
diff --git a/arch/powerpc/platforms/pseries/reconfig.c b/arch/powerpc/platforms/pseries/reconfig.c
index 286b6af3d55d..168651acdd83 100644
--- a/arch/powerpc/platforms/pseries/reconfig.c
+++ b/arch/powerpc/platforms/pseries/reconfig.c
@@ -114,9 +114,7 @@ int pSeries_reconfig_notify(unsigned long action, void *p)
114 int err = blocking_notifier_call_chain(&pSeries_reconfig_chain, 114 int err = blocking_notifier_call_chain(&pSeries_reconfig_chain,
115 action, p); 115 action, p);
116 116
117 if (err == NOTIFY_BAD) 117 return notifier_to_errno(err);
118 return -ENOMEM; /* For now, safe to assume kmalloc failure */
119 return 0;
120} 118}
121 119
122static int pSeries_reconfig_add_node(const char *path, struct property *proplist) 120static int pSeries_reconfig_add_node(const char *path, struct property *proplist)