From: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx> 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@xxxxxxxxxxxxxxxxxxxxx> --- 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 -- To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html