Skip to contentSkip to conversation

x86/mm/kmmio: return -ENOMEM when kzalloc failed

PATCH New Jiapeng Chong 1 participant 1 message Jul 27, 2023

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

PATCH 1/1 x86/mm/kmmio: return -ENOMEM when kzalloc failed

The driver is using -1 instead of the -ENOMEM defined macro to specify that a buffer allocation failed.

arch/x86/mm/kmmio.c:392 add_kmmio_fault_page() warn: returning -1 instead of -ENOMEM is sloppy.

---
 arch/x86/mm/kmmio.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/mm/kmmio.c +2 -2
index 9f82019179e1..9aa5bcf5a836 100644
@@ -389,14 +389,14 @@ static int add_kmmio_fault_page(unsigned long addr)
 
 	f = kzalloc(sizeof(*f), GFP_ATOMIC);
 	if (!f)
-		return -1;
+		return -ENOMEM;
 
 	f->count = 1;
 	f->addr = addr;
 
 	if (arm_kmmio_fault_page(f)) {
 		kfree(f);
-		return -1;
+		return -ENOMEM;
 	}
 
 	list_add_rcu(&f->list, kmmio_page_list(f->addr));
Signature · 1 line
2.20.1.7.g153144c