lkml.org 
[lkml]   [2023]   [Jul]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] x86/mm/kmmio: return -ENOMEM when kzalloc failed
Date
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.

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=6002
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
---
arch/x86/mm/kmmio.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/mm/kmmio.c b/arch/x86/mm/kmmio.c
index 9f82019179e1..9aa5bcf5a836 100644
--- a/arch/x86/mm/kmmio.c
+++ b/arch/x86/mm/kmmio.c
@@ -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));
--
2.20.1.7.g153144c
\
 
 \ /
  Last update: 2023-07-27 09:50    [W:0.035 / U:0.792 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site