Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754992AbdL1Uby (ORCPT ); Thu, 28 Dec 2017 15:31:54 -0500 Received: from mout.web.de ([217.72.192.78]:65005 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753794AbdL1Ubw (ORCPT ); Thu, 28 Dec 2017 15:31:52 -0500 Subject: [PATCH 1/2] pcmcia/rsrc_nonstatic: Delete an error message for a failed memory allocation in two functions From: SF Markus Elfring To: linux-pcmcia@lists.infradead.org Cc: LKML , kernel-janitors@vger.kernel.org References: <19f2a908-8515-ce68-bbba-e74dd90d6ad2@users.sourceforge.net> Message-ID: <83f35ec9-6c67-a321-290d-c4ad9b401171@users.sourceforge.net> Date: Thu, 28 Dec 2017 21:31:30 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <19f2a908-8515-ce68-bbba-e74dd90d6ad2@users.sourceforge.net> Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K0:Np9LTp7iw3SjmIfpdxH8C36nTuekv44elFbt+d7I3bgOHtb7478 WDqBWzX30eBCmyyCoUWlgCM0fJpHO9ArjsG16ZIre1IxUEaK7/Q5m03ElagZMcUQ8xMu53L LyIof0FBeSS0G6oVE5/+QKPyudjucrrqCtmUIGmiy6RIQG+SJ3ekP0ZQMsTnMSjyMbxZ4Y+ y/9egSQFtJAyXZ+uUKovQ== X-UI-Out-Filterresults: notjunk:1;V01:K0:cCovEIsXKv0=:PPJPWG0q6sOOCcq2cS2Bi6 lYZaEko7Cuc3hSrpNPRsriLKhg0b81umqQftWSWNC5CsYfODEe8m+qA1pKzgvaeYaV6Z0RY66 hFhn6eaWWwWDIxAy84+PHoiSVS2EGQVSuiVUdmTF0RGsleBWiG3RazLWnyXBktZCT/Dh5z2bz heEYdmx1UOA9k2mcDpQYeEINUlttgSOdlmh/PTVWRIK6CZaXlsTDYnzqaJyCuu4cEgQJsYAwZ 9JzIVni3+UbbZ+8iE+2sx9Br7wuXsiJ+8Cuw4LKW7+Im7qmER2ZrVKtX6YcpLnPnr4NUa9Mwm +2qzo6PtsfUAwsX6TibkMV94hRbltXz9FkjcKTO4Yel/Al6wADT5RcWDmEtObtiFAkiXRYbvE BbpvLbTBfTnElpPRozXYv8PLTWG2WaTlfhZe4YfhVuC2pMXgMXuwlHIPFJcvmk2bsQLo48wdz d18CY17nYbyJL1PrcWpV8TmvWmKuiwyagSKJPZ0ek8nfpT4pCFdmUOmKPmen5ZzJEEYQM010n y0qUTMhy7cmWzAjhYYAhV7SPH1K6on9ZYNjq4G7WZkER8CHfOscjkbwJrufpqU51C/62E0kBp OUYuSnYbdXmsMd05sedBoc2CTX2CEdTSNDg485IMsf4dm+7nfwWoAlr0eL4Duj6dRIgjnn9wC ToZzz0xG0Y8yJYxJdq3dOHNPt5AmVpxn4rna35HGcxEg4qCQrJtZgyM3AdE8ijiP1UrKwI3YZ E/Ufb+Xku5fDeObuK7PhBdJ5DgJNVR1JDtvoxy6OTopPa/4m+5ylVwl+6vKyajcVFAdKI/AOD rMtkgyRwL2Gec5Jzxe+aWJ56LwEatIo8m8SbboOawkaHjey700= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1376 Lines: 44 From: Markus Elfring Date: Thu, 28 Dec 2017 21:00:13 +0100 Omit an extra message for a memory allocation failure in these functions. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- 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 5ef7b46a2578..91dc559e4a81 100644 --- a/drivers/pcmcia/rsrc_nonstatic.c +++ b/drivers/pcmcia/rsrc_nonstatic.c @@ -121,10 +121,9 @@ static int add_interval(struct resource_map *map, u_long base, u_long num) break; } q = kmalloc(sizeof(struct resource_map), GFP_KERNEL); - 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; @@ -160,10 +159,9 @@ static int sub_interval(struct resource_map *map, u_long base, u_long num) /* Split the block into two pieces */ p = kmalloc(sizeof(struct resource_map), GFP_KERNEL); - 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.15.1