Skip to contentSkip to conversation

x86: return proper error code

PATCH RESEND In review Davidlohr Bueso 3 participants 3 messages Sep 30, 2010 – Oct 1, 2010

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/1 x86: return proper error code

x86: return -ENOMEM instead of -1 when returning on memory allocation errors in add_kmmio_fault_page()

---
 arch/x86/mm/kmmio.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/x86/mm/kmmio.c +1 -1
index e5d5e2c..36a4347 100644
@@ -370,7 +370,7 @@ static int add_kmmio_fault_page(unsigned long page)
 
 	f = kzalloc(sizeof(*f), GFP_ATOMIC);
 	if (!f)
-		return -1;
+		return -ENOMEM;
 
 	f->count = 1;
 	f->page = page;
Signature · 9 lines
1.7.0.4



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
#1 lore raw
Quoted 12 lines · Davidlohr Bueso

x86: return -ENOMEM instead of -1 when returning on memory allocation errors in add_kmmio_fault_page()

---
 arch/x86/mm/kmmio.c |    2 +-

 1 files changed, 1 insertions(+), 1 deletions(-)
arch/x86/mm/kmmio.c +0 -0
index e5d5e2c..36a4347 100644

arch/x86/mm/kmmio.c static int add_kmmio_fault_page(unsigned long page) · line 376

Quoted 8 lines
arch/x86/mm/kmmio.c +1 -1
@@ -370,7 +370,7 @@ static int add_kmmio_fault_page(unsigned long page)
 
        f = kzalloc(sizeof(*f), GFP_ATOMIC);
        if (!f)
-               return -1;
+               return -ENOMEM;
 
        f->count = 1;
        f->page = page;

This doesn't matter much as register_kmmio_probe() doesn't do anything sane with the error code and ioremap_trace_core() ignores what register_mmio_probe() does completely. I'd either keep the code as-is or try to fix up the fishy error handling properly.

#2 lore raw
Quoted 22 lines · On Thu, 30 Sep 2010 22:49:36 +0300 Pekka Enberg <[email protected]> wrote:
Quoted 20 lines · Davidlohr Bueso

x86: return -ENOMEM instead of -1 when returning on memory allocation errors in add_kmmio_fault_page()

---
 arch/x86/mm/kmmio.c |    2 +-

 1 files changed, 1 insertions(+), 1 deletions(-)
arch/x86/mm/kmmio.c +1 -1
index e5d5e2c..36a4347 100644
@@ -370,7 +370,7 @@ static int add_kmmio_fault_page(unsigned
 long page)
 
        f = kzalloc(sizeof(*f), GFP_ATOMIC);
        if (!f)
-               return -1;
+               return -ENOMEM;
 
Quoted 8 lines
Quoted 2 lines
arch/x86/mm/kmmio.c +0 -0
        f->count = 1;

       f->page = page;

This doesn't matter much as register_kmmio_probe() doesn't do anything sane with the error code and ioremap_trace_core() ignores what register_mmio_probe() does completely. I'd either keep the code as-is or try to fix up the fishy error handling properly.

Yes, I agree completely with Pekka.

Signature · 2 lines
Pekka Paalanen
http://www.iki.fi/pq/