Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1641724

[PATCH 2/2] pcmcia: Delete an error message for a failed memory allocation in two functions

From SF Markus Elfring <elfring@users.sourceforge.net>
Newsgroups linux.kernel
Subject [PATCH 2/2] pcmcia: Delete an error message for a failed memory allocation in two functions
Date 2017-05-15 16:10 +0200
Message-ID <tHoRc-KQ-23@gated-at.bofh.it> (permalink)
References <tHoRb-KQ-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH 0/2] PCMCIA-Resource management: Adjustments for three  function implementations SF Markus Elfring <elfring@users.sourceforge.net> - 2017-05-15 16:10 +0200
  [PATCH 1/2] pcmcia: Improve a size determination in three functions SF Markus Elfring <elfring@users.sourceforge.net> - 2017-05-15 16:10 +0200
  [PATCH 2/2] pcmcia: Delete an error message for a failed memory  allocation in two functions SF Markus Elfring <elfring@users.sourceforge.net> - 2017-05-15 16:10 +0200

csiph-web