diff mbox series

CAPI: return -ENOMEM when kmalloc failed

Message ID 20240314020103.54049-1-jiapeng.chong@linux.alibaba.com (mailing list archive)
State Changes Requested
Headers show
Series CAPI: return -ENOMEM when kmalloc failed | expand

Checks

Context Check Description
netdev/series_format warning Single patches do not need cover letters; Target tree name not specified in the subject
netdev/tree_selection success Guessed tree name to be net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 939 this patch: 939
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers warning 2 maintainers not CCed: jirislaby@kernel.org gregkh@linuxfoundation.org
netdev/build_clang success Errors and warnings before: 956 this patch: 956
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 956 this patch: 956
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-03-14--12-00 (tests: 908)

Commit Message

Jiapeng Chong March 14, 2024, 2:01 a.m. UTC
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@linux.alibaba.com>
Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=8522
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
---
 drivers/isdn/capi/capi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Andrew Lunn March 14, 2024, 3:17 a.m. UTC | #1
On Thu, Mar 14, 2024 at 10:01:03AM +0800, Jiapeng Chong wrote:
> 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@linux.alibaba.com>
> Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=8522
> Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>

The patch itself looks reasonable. The caller only cares about is the
return code negative or not. So returning -ENOMEM or -1 makes no
difference.

Please take a look at:

https://www.kernel.org/doc/html/latest/process/maintainer-netdev.html

You need to specify a tree you want this merged via.

If you consider this a fix, you need to add a Fixes: tag. However, i
don't see this patch meeting stable requirements.

If this is just normal development, net-next is closed at the moment
for the merge window. Please repost in two weeks time.

    Andrew
diff mbox series

Patch

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);