[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240314020103.54049-1-jiapeng.chong@linux.alibaba.com>
Date: Thu, 14 Mar 2024 10:01:03 +0800
From: Jiapeng Chong <jiapeng.chong@...ux.alibaba.com>
To: isdn@...ux-pingi.de
Cc: ricardo@...liere.net,
netdev@...r.kernel.org,
linux-kernel@...r.kernel.org,
Jiapeng Chong <jiapeng.chong@...ux.alibaba.com>,
Abaci Robot <abaci@...ux.alibaba.com>
Subject: [PATCH] CAPI: return -ENOMEM when kmalloc failed
The driver is using -1 instead of the -ENOMEM defined macro to specify
that a buffer allocation failed.
drivers/isdn/capi/capi.c:154 capiminor_add_ack() 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=8522
Signed-off-by: Jiapeng Chong <jiapeng.chong@...ux.alibaba.com>
---
drivers/isdn/capi/capi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/isdn/capi/capi.c b/drivers/isdn/capi/capi.c
index 3ed257334562..b6764313fbdb 100644
--- a/drivers/isdn/capi/capi.c
+++ b/drivers/isdn/capi/capi.c
@@ -151,7 +151,7 @@ static int capiminor_add_ack(struct capiminor *mp, u16 datahandle)
n = kmalloc(sizeof(*n), GFP_ATOMIC);
if (unlikely(!n)) {
printk(KERN_ERR "capi: alloc datahandle failed\n");
- return -1;
+ return -ENOMEM;
}
n->datahandle = datahandle;
INIT_LIST_HEAD(&n->list);
--
2.20.1.7.g153144c
Powered by blists - more mailing lists