lkml.org 
[lkml]   [2023]   [Nov]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] CAPI: Return -ENOMEM instead of -1
Date
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@huawei.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
\
 
 \ /
  Last update: 2023-11-01 11:06    [W:0.068 / U:0.044 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site