Jiapeng Chong
2023-Jul-27 07:42 UTC
[Nouveau] [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 at linux.alibaba.com> Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=6002 Signed-off-by: Jiapeng Chong <jiapeng.chong at 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