From patchwork Wed Jan 3 20:52:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SF Markus Elfring X-Patchwork-Id: 855211 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=65.50.211.133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="eHKhrJXd"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zBjnW2zHkz9s71 for ; Thu, 4 Jan 2018 07:53:19 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Date:Message-ID:Subject: From:To:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=LJZHpvuuvearItSsVNStVsOI4uWbJRgGnXRHVnRxERI=; b=eHKhrJXdDioHFg YUJN8Nkf2+M/f590zRBPoOh7/HOldxOTih2PMCgKe1UQByE16ijjnUFYUGFSxzKscqS6xdHNLPOhQ nZ2Xej0Ei26xaEEr3NsmcMzjfcA82lew1EzHCDYutcIjEYgMWrUmgZdZ0jwWmHWEbyf6WLE/Mdsrx jnF5lkcnbrCsuqdLiFXtGhJ62tfVDrHa7kYUZw1yyFh9wfewLBo7Uez46kWcI0vrKSv5AjhT/vYRV G6ZxPYNNMg/VZg2ufnpYVAV6VjRrnsm/GSLe5s6+mwWFPr36UtjWZz1Id3mySy5mb/zVOYyv2gcr6 mSE7/D7m8s6vOK3IbOjA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1eWq2B-0000P1-8P; Wed, 03 Jan 2018 20:53:11 +0000 Received: from mout.web.de ([212.227.17.12]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1eWq1a-0007zl-Rl for linux-mtd@lists.infradead.org; Wed, 03 Jan 2018 20:52:43 +0000 Received: from [192.168.1.3] ([77.182.96.2]) by smtp.web.de (mrweb101 [213.165.67.124]) with ESMTPSA (Nemesis) id 0LmcnP-1f6Roo0VT1-00aG6y; Wed, 03 Jan 2018 21:52:09 +0100 To: linux-mtd@lists.infradead.org, Boris Brezillon , Brian Norris , Cyrille Pitchen , David Woodhouse , Marek Vasut , Richard Weinberger From: SF Markus Elfring Subject: [PATCH] mtd/inftlmount: Delete error messages for a failed memory allocation in two functions Message-ID: Date: Wed, 3 Jan 2018 21:52:07 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 Content-Language: en-GB X-Provags-ID: V03:K0:dJrZW7xpgbzgGBw/8fFkOiSq4HmPsKf8Hw49390iPFIZPAfUo/Q 4UmsP19zfn+K9MerDt2bqxBjbbacTAtfWrJN4rvEmqDZYS9uLFN74n1fdu44pVil2nts72C JX28TMSJjH26VYif3kHNAIUN2Pdx2rLE0zGLAowbn2xikOqlMchpOPFOvyiQSeT2UvxtAeo fxlkQ3tfNxI850k4XcC1A== X-UI-Out-Filterresults: notjunk:1; V01:K0:u3J7oTy85Zc=:mF4fn2SSm9s80oze5F+QhQ HfKTQYHUb599nR+3UCgdGNCH5SlU+Db3R5WCw+hVWWtT1BQRoyWsUI6+oORI76gtVStJzWvO7 tbUFizTEtL7wC0vZ9KUgOE4LP8uELrHE/+78asbxyjjr7KO9LfFRU4swVtaRd59oHAZyTTzBd 91tWbKmnaOgBtY9/Jcc7DYrJpZeF0vbGwLscrGH5AOPoffCdPMgaCAIREvLyjLk5sJb9qwUF/ hV27qKhPT7dw0W2YPIY9M3/DjgwXF7zsDzkDfz6H0ZE8PsTaMra1iRw8yhWqjXPY7lkQpEg4p bxTzWiZ/FHZgPwR1r0NIrGyKXi/4oAcXYMFtdXKZb0ueL2bbDXI6HnBfu3P7VOgTHoIhFBMY3 cCM0V/MXEjzJAQ7xXRUEAFB+70yvVAIu27mZqf3UWJwE7sFDlX5o03pCw13jxQWSC4be5Hs7v ooCSmmqOFS8GcddOBe4ir2o9vaC+xpoC5n8TcUVjzC4SmDtZD1A/SJ+M4U+UbRornjkAgYkBE AMRERRjMNDVblSAK7JJS671nhyuG30zOXWTybrnCWdSOzh4mJRgUaEJLUtXcenZwAstzXR1dF SQlNgjLY/3bksHWPx1q4mEqBYYb9PjX9692usOsbIaAz0fKpGgWwBeUrxsBJQxxEsvWez+XMz 8OXdqJpI7erB59D95W4JV4+jYzn4ccbN38DHfj+QiBNdX5pUgTUJm/rkv+3m828xDvJ0vXUgJ vNMfxkBzQ5PAGuDVvnkiR+gQLdLDwNsX3TWvtEEz1fZC/eANyt2zAHqGNkNrVBnZ00mESL7YS t8a2c5lp1uLSxlJKe/ljOcSFZB9WVcC4wFerwwfm7tnPLrmr84= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180103_125236_090481_C2A855F0 X-CRM114-Status: UNSURE ( 8.56 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [212.227.17.12 listed in wl.mailspike.net] -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [212.227.17.12 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.0 RCVD_IN_MSPIKE_WL Mailspike good senders X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kernel-janitors@vger.kernel.org, LKML Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org From: Markus Elfring Date: Wed, 3 Jan 2018 21:45:19 +0100 Omit extra messages for a memory allocation failure in these functions. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring --- drivers/mtd/inftlmount.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/drivers/mtd/inftlmount.c b/drivers/mtd/inftlmount.c index 8d6bb189ea8e..e5dd55021602 100644 --- a/drivers/mtd/inftlmount.c +++ b/drivers/mtd/inftlmount.c @@ -273,19 +273,12 @@ static int find_boot_record(struct INFTLrecord *inftl) /* Memory alloc */ inftl->PUtable = kmalloc(inftl->nb_blocks * sizeof(u16), GFP_KERNEL); - if (!inftl->PUtable) { - printk(KERN_WARNING "INFTL: allocation of PUtable " - "failed (%zd bytes)\n", - inftl->nb_blocks * sizeof(u16)); + if (!inftl->PUtable) return -ENOMEM; - } inftl->VUtable = kmalloc(inftl->nb_blocks * sizeof(u16), GFP_KERNEL); if (!inftl->VUtable) { kfree(inftl->PUtable); - printk(KERN_WARNING "INFTL: allocation of VUtable " - "failed (%zd bytes)\n", - inftl->nb_blocks * sizeof(u16)); return -ENOMEM; } @@ -562,12 +555,8 @@ int INFTL_mount(struct INFTLrecord *s) /* Temporary buffer to store ANAC numbers. */ ANACtable = kcalloc(s->nb_blocks, sizeof(u8), GFP_KERNEL); - if (!ANACtable) { - printk(KERN_WARNING "INFTL: allocation of ANACtable " - "failed (%zd bytes)\n", - s->nb_blocks * sizeof(u8)); + if (!ANACtable) return -ENOMEM; - } /* * First pass is to explore each physical unit, and construct the