[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20231101100450.120680-1-renmingshuai@huawei.com>
Date: Wed, 1 Nov 2023 18:04:50 +0800
From: Ren Mingshuai <renmingshuai@...wei.com>
To: <jirislaby@...nel.org>
CC: <gregkh@...uxfoundation.org>, <linux-kernel@...r.kernel.org>,
<caowangbao@...wei.com>, <yanan@...wei.com>, <liaichun@...wei.com>
Subject: [PATCH] CAPI: Return -ENOMEM instead of -1
It is more reasonable to return -ENOMEM instead of -1 when kmalloc
failed, although the caller doesn't care.
smatch warinings:
drivers/isdn/capi/capi.c:151 capiminor_add_ack() warn: returning -1 instead of -ENOMEM is sloppy
Signed-off-by: Ren Mingshuai <renmingshuai@...wei.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 2f3789515..6522f031a 100644
--- a/drivers/isdn/capi/capi.c
+++ b/drivers/isdn/capi/capi.c
@@ -149,7 +149,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.27.0
Powered by blists - more mailing lists