Messages in this thread Patch in this message | | | From | Ren Mingshuai <> | Subject | [PATCH] CAPI: Return -ENOMEM instead of -1 | Date | Wed, 1 Nov 2023 18:04:50 +0800 |
| |
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
| |