[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20230727074256.118672-1-jiapeng.chong@linux.alibaba.com>
Date: Thu, 27 Jul 2023 15:42:56 +0800
From: Jiapeng Chong <jiapeng.chong@...ux.alibaba.com>
To: rostedt@...dmis.org
Cc: mhiramat@...nel.org, karolherbst@...il.com, ppaalanen@...il.com,
dave.hansen@...ux.intel.com, luto@...nel.org, peterz@...radead.org,
tglx@...utronix.de, mingo@...hat.com, bp@...en8.de, x86@...nel.org,
hpa@...or.com, linux-kernel@...r.kernel.org,
nouveau@...ts.freedesktop.org,
Jiapeng Chong <jiapeng.chong@...ux.alibaba.com>,
Abaci Robot <abaci@...ux.alibaba.com>
Subject: [PATCH] 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.
Reported-by: Abaci Robot <abaci@...ux.alibaba.com>
Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=6002
Signed-off-by: Jiapeng Chong <jiapeng.chong@...ux.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
Powered by blists - more mailing lists