diff mbox

[1/2] atm: iphase: return -ENOMEM instead of -1 in case of failed kmalloc()

Message ID 1444506439-10414-2-git-send-email-theidsieck@leenox.de
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Tillmann Heidsieck Oct. 10, 2015, 7:47 p.m. UTC
Smatch complains about returning hard coded error codes, silence this
warning.

drivers/atm/iphase.c:115 ia_enque_rtn_q() warn: returning -1 instead of -ENOMEM is sloppy

Signed-off-by: Tillmann Heidsieck <theidsieck@leenox.de>
---
 drivers/atm/iphase.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

David Miller Oct. 13, 2015, 2:56 a.m. UTC | #1
From: Tillmann Heidsieck <theidsieck@leenox.de>
Date: Sat, 10 Oct 2015 21:47:18 +0200

> Smatch complains about returning hard coded error codes, silence this
> warning.
> 
> drivers/atm/iphase.c:115 ia_enque_rtn_q() warn: returning -1 instead of -ENOMEM is sloppy
> 
> Signed-off-by: Tillmann Heidsieck <theidsieck@leenox.de>

Applied to net-next.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/atm/iphase.c b/drivers/atm/iphase.c
index 65e65903faa0..d5010d7a99c3 100644
--- a/drivers/atm/iphase.c
+++ b/drivers/atm/iphase.c
@@ -112,7 +112,8 @@  static void ia_enque_head_rtn_q (IARTN_Q *que, IARTN_Q * data)
 
 static int ia_enque_rtn_q (IARTN_Q *que, struct desc_tbl_t data) {
    IARTN_Q *entry = kmalloc(sizeof(*entry), GFP_ATOMIC);
-   if (!entry) return -1;
+   if (!entry)
+      return -ENOMEM;
    entry->data = data;
    entry->next = NULL;
    if (que->next == NULL)