Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753030AbeADUYr (ORCPT + 1 other); Thu, 4 Jan 2018 15:24:47 -0500 Received: from mout.web.de ([217.72.192.78]:53232 "EHLO mout.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752486AbeADUYp (ORCPT ); Thu, 4 Jan 2018 15:24:45 -0500 To: linux-mtd@lists.infradead.org, Boris Brezillon , Brian Norris , Cyrille Pitchen , David Woodhouse , Marek Vasut , Richard Weinberger Cc: LKML , kernel-janitors@vger.kernel.org From: SF Markus Elfring Subject: [PATCH] mtdoops: Delete an error message for a failed memory allocation in two functions Message-ID: Date: Thu, 4 Jan 2018 21:24:12 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:MJNw5d6omsXJ0rRbugCdN+Bt263eKiGvF6XHPIBlWhBMl1uTC6/ SCXHoi5TsMRTWjUoHh6LZIFFjjbzJ9FybzIzTheAAoJkLFFOzImJx3G+0O6Fp6UxUY9vGay fw2gSUI7NHBpsq8Of7w0tMeORmlHveFDrdxvJHopuu9vxcNn+KZ5MBlr7z3oR7D52dpbRbR 6sKHfVE5o70wk8T8a1l0Q== X-UI-Out-Filterresults: notjunk:1;V01:K0:DAs5s+ONplg=:DhOCFA4TSxbUceIyZlNtU+ FnYdQyyJQYkIWoPbuQgKA3tXV8DbVn42QomlxvGselUqfcwJFZ8iMdw6YhJlE/hg+asHGpe0W zgouR506aS7hYdzUNEc4dg7COIErUBiyrmiCCrXybjhv4Zk9oOf2kXBNORq6lnQ3zd7ipGGgl dIldqvhr2bwN7pntgav7BhcaOiFbZo9t1dE2y7zp6DEBk5fA9fBNajFOCcObyG6uoY7xC8Uey /aEie2o9GP5FgIQ015EkGBTE2SKce3FoYej0xMD/cSE2VErMl5PHHIfQFqoKFJbIcZWL5VDrz wFhf6gV2cB0+yar7RrNDJYVeBCk+rLGLM8lXpm84v0s/bSKsyiZSuk3Vw3Krz/y+DSEo0EhEH ulWAqrG2XDY3JpozG/XpXzbRDVQYx/STgq70FL40gNHszPh2OIEXo296Pmttp4rQ78UhXA3GF n1Jr2//c7nlwnlacEeEHFGBD2UUN9oXxJPdPnlywLaiY4Ipwud3AW5gjAMw55HoNd8LnMMj5r llUCEOkMrHTtsJaJjyu4X7BgF+/el3jdpvl/2uQgmLMbBfgRFiJUpRBU3nClt8DdKEmxy1sDS kUdCPEyi780QLkkhJsRXWsz/MjFFICSrsWweg5mJA2/ECP1avVWLk9pbEiQM+eT3wvkXlCgJx 1DgANjn92feEYsqyq9SQWgc2YDD8Wr+IAuEF+kfuRJLZbReYeY+mkBxnTKW4AdHliHF0ngUo5 VPAGhNNb3sR53VXJmhGYDlHPCvgABNat+XvUwvBotqLn8uU+1DlPswK2fYqCWBWtAD4NluBVj kCXTnWz7ZG4DWgCsl5KNKjehwicjERt2MMXhwq1xS+Tp6Ivkws= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: From: Markus Elfring Date: Thu, 4 Jan 2018 21:10:56 +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/mtd/mtdoops.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/mtd/mtdoops.c b/drivers/mtd/mtdoops.c index 97bb8f6304d4..ea8619ec970b 100644 --- a/drivers/mtd/mtdoops.c +++ b/drivers/mtd/mtdoops.c @@ -352,10 +352,8 @@ static void mtdoops_notify_add(struct mtd_info *mtd) /* oops_page_used is a bit field */ cxt->oops_page_used = vmalloc(DIV_ROUND_UP(mtdoops_pages, BITS_PER_LONG) * sizeof(unsigned long)); - if (!cxt->oops_page_used) { - printk(KERN_ERR "mtdoops: could not allocate page array\n"); + if (!cxt->oops_page_used) return; - } cxt->dump.max_reason = KMSG_DUMP_OOPS; cxt->dump.dump = mtdoops_do_dump; @@ -420,10 +418,9 @@ static int __init mtdoops_init(void) cxt->mtd_index = mtd_index; cxt->oops_buf = vmalloc(record_size); - if (!cxt->oops_buf) { - printk(KERN_ERR "mtdoops: failed to allocate buffer workspace\n"); + if (!cxt->oops_buf) return -ENOMEM; - } + memset(cxt->oops_buf, 0xff, record_size); INIT_WORK(&cxt->work_erase, mtdoops_workfunc_erase); -- 2.15.1