Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965284AbbLWSJ0 (ORCPT ); Wed, 23 Dec 2015 13:09:26 -0500 Received: from mout.web.de ([212.227.17.11]:57032 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965230AbbLWSJX (ORCPT ); Wed, 23 Dec 2015 13:09:23 -0500 Subject: [PATCH 2/5] block-LDM: Delete extra log messages for memory allocation failures To: linux-ntfs-dev@lists.sourceforge.net, linux-block@vger.kernel.org, Jens Axboe , Richard Russon References: <566ABCD9.1060404@users.sourceforge.net> <567A6CDB.4030703@users.sourceforge.net> <567AE1C6.9020108@users.sourceforge.net> Cc: Julia Lawall , LKML , kernel-janitors@vger.kernel.org From: SF Markus Elfring Message-ID: <567AE34E.9000008@users.sourceforge.net> Date: Wed, 23 Dec 2015 19:09:18 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0 MIME-Version: 1.0 In-Reply-To: <567AE1C6.9020108@users.sourceforge.net> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:25tWWKtatIDGJQW8xghJxosSihc8W5aSxKF/rg9DxBPrjrwqlMK UO+nn+mhThSsZ5sPbkoO8kOOvRwpZn7vtwUmg9lhJ0RfpJVCC4AApQOQCqK653U+B8rTy8A 0IVnnrEpW+e23EejKle/wyFyGwae5ZzqSHF94yydXeEENSd+CELt5snGfWIusXwJX1SEzBD 7G/pWxmHMuMBsqUNtyDOA== X-UI-Out-Filterresults: notjunk:1;V01:K0:HbttB3GDz0E=:h0Ewfz/nlpDdV4Xlj3WXHe KanCDohPDsa/0nU/ba21maVI5uornsCK+WEljhVFN+G3hToz3pzN7z8nJca3H2YKubuoz8m7Q CzXqCDwspGPzmiWXSuqqj0LDfFaQZpmI/+Uqo4BJpZdPuSOHjb6O0pk/gbmKHi61C6BsRNmCP q4P2SVAI+1mkPbHVnVso8SXKwDY1UL9YPNgG5Gh77TUeVA0WCAmt4S+EZAsqq7ajtX5cRkz4m IseywO6JpEQBhsNSRza6oUfqlUvLtlDzGGLhgCQyiwE2dICq9KCgdkWKklsECWQvM5KZG2sWH COU9EwwenFhAnJaFlXl43X8m+bYULWOINrfrHokRUvVcqBAJVG4iebeyYyHr3yr9il2ofuRbu z4j4USC2ApDEof2hm0zieCkNOkyb4Roqjk4fmapoqgiVNIoR42dFrdctExDZ1TKUulEsp3cW0 VsMQ8adiB5ltAuOHMZE8otF7h3PxJ+ax1DT4IXYDZ/WwbqEIsY/SVQDgvoqmU+tEycZe+7kSi oOhKFfPKwa0FoXiZ858KSs7sOGFllK1/yF3rIb7X9o4mPP2+Mhha9RJnvxiRtsCateq4PKhje d7oT0F13OPYcvpc/pqlsFILhF7pHBK5Gpcpuav6xSTDrNpmynHwBGIRwkh+3S9OupYMvpVfHI 1wt25dygDqdtxeBLe/m1WykX0yVkvtPfP/+ncDMtjO13vmWHa9XzbKuBqvTECF0LCJEUAlHif Rons2iiMCDC3fXwqjKRakky4kqmNR1yz2efIVHGpZdEr+cGWDQSb/AXBMF1qoiIE+aUMh6Jla w1X7oCu Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2498 Lines: 85 From: Markus Elfring Date: Wed, 23 Dec 2015 13:21:01 +0100 A failed call of the kmalloc() function can generate appropriate information about insufficient memory already. Thus remove unnecessary log messages for such failures. Suggested-by: Julia Lawall Signed-off-by: Markus Elfring --- block/partitions/ldm.c | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/block/partitions/ldm.c b/block/partitions/ldm.c index a50385c..856658a 100644 --- a/block/partitions/ldm.c +++ b/block/partitions/ldm.c @@ -343,10 +343,8 @@ static bool ldm_validate_privheads(struct parsed_partitions *state, ph[1] = kmalloc (sizeof (*ph[1]), GFP_KERNEL); ph[2] = kmalloc (sizeof (*ph[2]), GFP_KERNEL); - if (!ph[1] || !ph[2]) { - ldm_crit ("Out of memory."); + if (!ph[1] || !ph[2]) goto out; - } /* off[1 & 2] are relative to ph[0]->config_start */ ph[0]->config_start = 0; @@ -431,10 +429,8 @@ static bool ldm_validate_tocblocks(struct parsed_partitions *state, ph = &ldb->ph; tb[0] = &ldb->toc; tb[1] = kmalloc(sizeof(*tb[1]) * 3, GFP_KERNEL); - if (!tb[1]) { - ldm_crit("Out of memory."); + if (!tb[1]) return false; - } tb[2] = (struct tocblock*)((u8*)tb[1] + sizeof(*tb[1])); tb[3] = (struct tocblock*)((u8*)tb[2] + sizeof(*tb[2])); /* @@ -1239,10 +1235,8 @@ static bool ldm_ldmdb_add (u8 *data, int len, struct ldmdb *ldb) BUG_ON (!data || !ldb); vb = kmalloc (sizeof (*vb), GFP_KERNEL); - if (!vb) { - ldm_crit ("Out of memory."); + if (!vb) return false; - } if (!ldm_parse_vblk (data, len, vb)) { kfree(vb); @@ -1325,10 +1319,8 @@ static bool ldm_frag_add (const u8 *data, int size, struct list_head *frags) } f = kmalloc (sizeof (*f) + size*num, GFP_KERNEL); - if (!f) { - ldm_crit ("Out of memory."); + if (!f) return false; - } f->group = group; f->num = num; @@ -1519,10 +1511,8 @@ int ldm_partition(struct parsed_partitions *state) return 0; ldb = kmalloc (sizeof (*ldb), GFP_KERNEL); - if (!ldb) { - ldm_crit ("Out of memory."); + if (!ldb) goto out; - } /* Parse and check privheads. */ if (!ldm_validate_privheads(state, &ldb->ph)) -- 2.6.3 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/