mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tillmann Heidsieck <theidsieck@leenox.de>
To: Chas Williams <3chas3@gmail.com>
Cc: linux-atm-general@lists.sourceforge.net, netdev@vger.kernel.org,
	kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org,
	Tillmann Heidsieck <theidsieck@leenox.de>
Subject: [PATCH 1/2] atm: iphase: return -ENOMEM instead of -1 in case of failed kmalloc()
Date: Sat, 10 Oct 2015 21:47:18 +0200	[thread overview]
Message-ID: <1444506439-10414-2-git-send-email-theidsieck@leenox.de> (raw)
In-Reply-To: <1444506439-10414-1-git-send-email-theidsieck@leenox.de>

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

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


  reply	other threads:[~2015-10-10 19:44 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-10 19:47 [PATCH 0/2] atm: iphase: Fix misleading indention and return -ENOMEM on error Tillmann Heidsieck
2015-10-10 19:47 ` Tillmann Heidsieck [this message]
2015-10-13  2:56   ` [PATCH 1/2] atm: iphase: return -ENOMEM instead of -1 in case of failed kmalloc() David Miller
2015-10-10 19:47 ` [PATCH 2/2] atm: iphase: fix misleading indention Tillmann Heidsieck
2015-10-13  2:56   ` David Miller
2015-10-12 15:28 ` [PATCH 0/2] atm: iphase: Fix misleading indention and return -ENOMEM on error Charles (Chas) Williams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1444506439-10414-2-git-send-email-theidsieck@leenox.de \
    --to=theidsieck@leenox.de \
    --cc=3chas3@gmail.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-atm-general@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®