mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: SF Markus Elfring <elfring@users.sourceforge.net>
To: linux-pcmcia@lists.infradead.org
Cc: LKML <linux-kernel@vger.kernel.org>,
	kernel-janitors@vger.kernel.org, Wolfram Sang <wsa@the-dreams.de>
Subject: [PATCH 2/2] pcmcia: Delete an error message for a failed memory allocation in two functions
Date: Mon, 15 May 2017 16:03:38 +0200	[thread overview]
Message-ID: <735d7330-c00d-618f-54c2-ddf54f3e06cc@users.sourceforge.net> (raw)
In-Reply-To: <0d48eee5-11d8-e44e-8c11-6370ae7a7ea1@users.sourceforge.net>

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Mon, 15 May 2017 15:23:42 +0200

Omit an extra message for a memory allocation failure in these functions.

This issue was detected by using the Coccinelle software.

Link: http://events.linuxfoundation.org/sites/events/files/slides/LCJ16-Refactor_Strings-WSang_0.pdf
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/pcmcia/rsrc_nonstatic.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/pcmcia/rsrc_nonstatic.c b/drivers/pcmcia/rsrc_nonstatic.c
index 2e03dd8f1157..7b5bc6f6f496 100644
--- a/drivers/pcmcia/rsrc_nonstatic.c
+++ b/drivers/pcmcia/rsrc_nonstatic.c
@@ -124,7 +124,6 @@ static int add_interval(struct resource_map *map, u_long base, u_long num)
-	if (!q) {
-		printk(KERN_WARNING "out of memory to update resources\n");
+	if (!q)
 		return -ENOMEM;
-	}
+
 	q->base = base; q->num = num;
 	q->next = p->next; p->next = q;
 	return 0;
@@ -162,7 +161,6 @@ static int sub_interval(struct resource_map *map, u_long base, u_long num)
-				if (!p) {
-					printk(KERN_WARNING "out of memory to update resources\n");
+				if (!p)
 					return -ENOMEM;
-				}
+
 				p->base = base+num;
 				p->num = q->base+q->num - p->base;
 				q->num = base - q->base;
-- 
2.13.0

      parent reply	other threads:[~2017-05-15 14:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-15 14:00 [PATCH 0/2] PCMCIA-Resource management: Adjustments for three function implementations SF Markus Elfring
2017-05-15 14:02 ` [PATCH 1/2] pcmcia: Improve a size determination in three functions SF Markus Elfring
2017-05-15 14:03 ` SF Markus Elfring [this message]

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=735d7330-c00d-618f-54c2-ddf54f3e06cc@users.sourceforge.net \
    --to=elfring@users.sourceforge.net \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pcmcia@lists.infradead.org \
    --cc=wsa@the-dreams.de \
    /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

Powered by JetHome