Messages in this thread Patch in this message | | | Subject | [PATCH 2/2] pcmcia: Delete an error message for a failed memory allocation in two functions | From | SF Markus Elfring <> | Date | Mon, 15 May 2017 16:03:38 +0200 |
| |
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
| |