From patchwork Tue Mar 20 15:31:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arushi Singhal X-Patchwork-Id: 888281 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=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="g2Z9/v1y"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Il4S9l7s"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::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 405H591grDz9s19 for ; Wed, 21 Mar 2018 02:33:17 +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:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From: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=ITOJt/KGGpS0D4el2csBkl5GdsB2nGmZJVeW0h/HA6s=; b=g2Z 9/v1y1cM2lWOvl8TteuJ3r008BnZall0SX8u4Xj2OVSW+3JgZR0kteeaMglPhAkH8IxMbwqQJ9st9 nKjMcHU8mvIfuE4fPGm0fB4MgDTGnpEn8Qc0SqUAkkfzGUqCPZT4dglP8EvT2pHne7xM6PA35TZ0A ulfENG3XzAO2sMFE6yJxyEbD79Gm8W5WhOCMOao3k06XJCS/3DVCgPqHbJPzs+4o+xDwC3CujuYk6 FDhFz5xCbz/3dYcKW8rgGuy2RbJ8M36sB6kTfTJal+3C0L1/UYFYujmSPtiP3kHMjtZFTTxwmxyCI JI2q4K9NqtKGpKiQBncQR7zXLI4xB9w==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1eyJG9-0003f7-LR; Tue, 20 Mar 2018 15:33:09 +0000 Received: from mail-pg0-x242.google.com ([2607:f8b0:400e:c05::242]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1eyJG7-0003dK-66; Tue, 20 Mar 2018 15:33:08 +0000 Received: by mail-pg0-x242.google.com with SMTP id g12so757739pgs.0; Tue, 20 Mar 2018 08:32:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=byyRb/01LbAfP0uzdTM8JyqSr6hnhuEsOxW7puBeUFk=; b=Il4S9l7sdR1kvFRx1Kl/Wbal5K5x6SoGrohLKkosA4RptnSLpWNj/SKnaV+jmDnMPa DF61HyTIAHbwCzkFdRJrm0LHdiBewUv79RjL3WPkcaa6DGFftrAwwnkcIbQGzfYIfO2M dtMH7qebQgjiN6eobwKkMxZ9/s6zrtnGPzIxyyRjIVA3wyPUHvjf/9li1WnVFr1YBTwR drFzqEBT2rHfMAY0iR1Hlw5S+JaKJzwhdhXeZnMlv4yvzNJ1onVXIvP29W7rGCQrrYIs BWWLfaWGzEOTOMewllQYdJjOlDn34q1TgbL2m43zepFi1iM6fcBRoUmBfJ2Hh6c+8mpk 3HuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=byyRb/01LbAfP0uzdTM8JyqSr6hnhuEsOxW7puBeUFk=; b=hGPni9e31SUMRRz/cUtCCdTL5r1YbOnh4fOxwFln1NimkbiQNXEG12/wDXuKtg+29p rgf+uz63TJYf0UZWz4K/QE6RPO8tQy3IWYyu215Ms7h6KA3PHnVdF6EAExv51laNE8Yf ieY0ppolHg7Hag2a2V1K2Dj3QQH1Shl1Uhi/Mvj6a1hDkPoSoCFQFBdaaFLa6BY29J5U OT0+0k+WfVb0mVYQreWwMWaqJ+5+ilazyaycxXjG+M7A1ThELrRLnkICkLcGAOrKS+o1 zgEJ8K538Mt2e1GYfFbGxT8tVmfP0BDe6mclswwtLPkstgaLjGipPeLPIklwPRWonYcV UhtQ== X-Gm-Message-State: AElRT7Ev2bQ746Km3w/l6lCU8coeRO/GvCOudOsMPTMiIVmGs8zm9BCP 3/cZ3t8wfgWFa5apCJZsiUU= X-Google-Smtp-Source: AG47ELufaWiKhYL1j8P9cnT7DSFqPzT/8ZL5LhlveJGy14hEADEhc6T1WwVqruIYp3T9L9Wm5FL4wQ== X-Received: by 10.99.6.198 with SMTP id 189mr12644165pgg.131.1521559976292; Tue, 20 Mar 2018 08:32:56 -0700 (PDT) Received: from seema-Inspiron-15-3567.iiit.ac.in ([14.139.82.6]) by smtp.googlemail.com with ESMTPSA id j185sm3649369pgc.79.2018.03.20.08.32.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 20 Mar 2018 08:32:54 -0700 (PDT) From: Arushi Singhal To: boris.brezillon@free-electrons.com Subject: [PATCH v2 1/2] mtd: maps: Remove print after allocation failure Date: Tue, 20 Mar 2018 21:01:24 +0530 Message-Id: <1521559885-10523-1-git-send-email-arushisinghal19971997@gmail.com> X-Mailer: git-send-email 2.7.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180320_083307_243814_710CC041 X-CRM114-Status: GOOD ( 12.18 ) X-Spam-Score: 0.1 (/) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (0.1 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [2607:f8b0:400e:c05:0:0:0:242 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (arushisinghal19971997[at]gmail.com) 0.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends in digit (arushisinghal19971997[at]gmail.com) -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 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: Arushi Singhal , richard@nod.at, miquel.raynal@free-electrons.com, linux-kernel@vger.kernel.org, nicolas.ferre@microchip.com, marek.vasut@gmail.com, linux-mtd@lists.infradead.org, rainyfeeling@outlook.com, alexandre.belloni@free-electrons.com, maxime.ripard@free-electrons.com, computersforpeace@gmail.com, dwmw2@infradead.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org The prints after [k|v][m|z|c]alloc() functions are not needed, because in case of failure, allocator will print their internal error prints anyway. Signed-off-by: Arushi Singhal --- changes in v2 * Prefered if (!map) { map = kmalloc(); if (!map) err; } than if (!map) map = kmalloc(); if (!map) err drivers/mtd/maps/amd76xrom.c | 6 ++---- drivers/mtd/maps/ck804xrom.c | 8 +++----- drivers/mtd/maps/esb2rom.c | 7 +++---- drivers/mtd/maps/ichxrom.c | 6 ++---- drivers/mtd/maps/sun_uflash.c | 4 +--- drivers/mtd/maps/vmu-flash.c | 3 --- 6 files changed, 11 insertions(+), 23 deletions(-) diff --git a/drivers/mtd/maps/amd76xrom.c b/drivers/mtd/maps/amd76xrom.c index 26de0a1..406a8d3 100644 --- a/drivers/mtd/maps/amd76xrom.c +++ b/drivers/mtd/maps/amd76xrom.c @@ -188,10 +188,8 @@ static int amd76xrom_init_one(struct pci_dev *pdev, if (!map) { map = kmalloc(sizeof(*map), GFP_KERNEL); - } - if (!map) { - printk(KERN_ERR MOD_NAME ": kmalloc failed"); - goto out; + if (!map) + goto out; } memset(map, 0, sizeof(*map)); INIT_LIST_HEAD(&map->list); diff --git a/drivers/mtd/maps/ck804xrom.c b/drivers/mtd/maps/ck804xrom.c index 584962e..7377623 100644 --- a/drivers/mtd/maps/ck804xrom.c +++ b/drivers/mtd/maps/ck804xrom.c @@ -216,12 +216,10 @@ static int __init ck804xrom_init_one(struct pci_dev *pdev, unsigned long offset; int i; - if (!map) - map = kmalloc(sizeof(*map), GFP_KERNEL); - if (!map) { - printk(KERN_ERR MOD_NAME ": kmalloc failed"); - goto out; + map = kmalloc(sizeof(*map), GFP_KERNEL); + if (!map) + goto out; } memset(map, 0, sizeof(*map)); INIT_LIST_HEAD(&map->list); diff --git a/drivers/mtd/maps/esb2rom.c b/drivers/mtd/maps/esb2rom.c index da9f6d7..2c63ecd 100644 --- a/drivers/mtd/maps/esb2rom.c +++ b/drivers/mtd/maps/esb2rom.c @@ -276,11 +276,10 @@ static int __init esb2rom_init_one(struct pci_dev *pdev, unsigned long offset; int i; - if (!map) - map = kmalloc(sizeof(*map), GFP_KERNEL); if (!map) { - printk(KERN_ERR MOD_NAME ": kmalloc failed"); - goto out; + map = kmalloc(sizeof(*map), GFP_KERNEL); + if (!map) + goto out; } memset(map, 0, sizeof(*map)); INIT_LIST_HEAD(&map->list); diff --git a/drivers/mtd/maps/ichxrom.c b/drivers/mtd/maps/ichxrom.c index 1888c5b..cacef9d 100644 --- a/drivers/mtd/maps/ichxrom.c +++ b/drivers/mtd/maps/ichxrom.c @@ -212,10 +212,8 @@ static int __init ichxrom_init_one(struct pci_dev *pdev, if (!map) { map = kmalloc(sizeof(*map), GFP_KERNEL); - } - if (!map) { - printk(KERN_ERR MOD_NAME ": kmalloc failed"); - goto out; + if (!map) + goto out; } memset(map, 0, sizeof(*map)); INIT_LIST_HEAD(&map->list); diff --git a/drivers/mtd/maps/sun_uflash.c b/drivers/mtd/maps/sun_uflash.c index 1e73bba..80a253c 100644 --- a/drivers/mtd/maps/sun_uflash.c +++ b/drivers/mtd/maps/sun_uflash.c @@ -62,10 +62,8 @@ int uflash_devinit(struct platform_device *op, struct device_node *dp) } up = kzalloc(sizeof(struct uflash_dev), GFP_KERNEL); - if (!up) { - printk(KERN_ERR PFX "Cannot allocate struct uflash_dev\n"); + if (!up) return -ENOMEM; - } /* copy defaults and tweak parameters */ memcpy(&up->map, &uflash_map_templ, sizeof(uflash_map_templ)); diff --git a/drivers/mtd/maps/vmu-flash.c b/drivers/mtd/maps/vmu-flash.c index 6b223cf..a76a5ff 100644 --- a/drivers/mtd/maps/vmu-flash.c +++ b/drivers/mtd/maps/vmu-flash.c @@ -130,9 +130,6 @@ static int maple_vmu_read_block(unsigned int num, unsigned char *buf, if (!pcache->buffer) { pcache->buffer = kmalloc(card->blocklen, GFP_KERNEL); if (!pcache->buffer) { - dev_err(&mdev->dev, "VMU at (%d, %d) - read fails due" - " to lack of memory\n", mdev->port, - mdev->unit); error = -ENOMEM; goto outB; } From patchwork Tue Mar 20 15:31:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arushi Singhal X-Patchwork-Id: 888282 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=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="do9fjDRH"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="rX+ml7cm"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::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 405H685MX7z9s19 for ; Wed, 21 Mar 2018 02:34:08 +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:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=CxgK1Nx74A59B0dieVuC+KvQAqP7Cl/xDQInDnoSrgQ=; b=do9fjDRHG3IxP4SKUwKQAerOa1 weOG1V2CZAUzhv4EVJcJ5dMvemeKeNjQkvEFQGOCNmrq5SH/g14XLSIqc1dz8WPWsJYYfc6tnspyF Jwske1iqty5Zf24ZHwk1XtmS6+E5JKUv5+mIzysd2T7B1YJkMepvHqoZsxfC6qsfliqwBSJSGYtgx vQDXap+PbP04UGvQL9SfhqNjAn397gHN6V6SHJLIn7URUx/sQ4IXNfMyxIvu2pgp4JjsFj7SnV/xm H+KzJr1zh5niqiuEaQCFi4GytzQ5/lTmsKoomRMehd/DfG9vHVgIYItiwcCZMpLuVBiQsuDZoEB3K g2bo0oXg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1eyJGt-0004BR-Vr; Tue, 20 Mar 2018 15:33:56 +0000 Received: from mail-pg0-x243.google.com ([2607:f8b0:400e:c05::243]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1eyJGC-0003e2-W7; Tue, 20 Mar 2018 15:33:25 +0000 Received: by mail-pg0-x243.google.com with SMTP id g8so753760pgv.7; Tue, 20 Mar 2018 08:33:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=9Qg/CHEYt1s2OV/Av5Boph9JVoqPBlkH6SEkw8nI3jw=; b=rX+ml7cmjvrwWBErGnzhPk/ZZsrbCtNBZlXm3VA+xRWMvN8LxVbFmEiVaYuU6qEh8P XcvfAOOWiCbo63nDqYzU2j9UoLrCrrWW/+J0PHnR9sWeSDzFk7pAgcf2/2NlpbZC2cax bCPc7S0wzx/u9hDVrCVhvQs+CEwp/kOHkO111RW8OYwKTF4OZXTlnd0d9jNZJ4hsnlHq eiq4+9hA184Poo041Z9ots1aUL1w0MW3cFwdnE75DcSFFvyJyPbBOUZbfeJJD60mTo36 stS8VRqvK79AaXb/x9Z7X38go2YKAwIJlcZt1iC1VEbmO/hmHw3CKduZCeGzxNjN6DYK 3CDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=9Qg/CHEYt1s2OV/Av5Boph9JVoqPBlkH6SEkw8nI3jw=; b=LGVOVYaNQ1jpNHt4sVDTRlE1GDwHiVzGv9DWZ+SUYGCqlLH/W1SRDgCiqEcrpK/M68 oVQeOSDExh01lyILIoDtO4ciWDruu+T58GJShcfPDp+tn3cnR/2SDfJFxGVmPAOzEH4B flUovIDxfsmgipuz8wyIRLQZgmj6jN1vUrgEhdJup7aWRvIkeKlryo31v8XqPfBcGsQO Jk6Jr3eUD3sT3/0+E9Vnum6lZE9T5+szQ2U2HL3PE9MDsefZb7NjFwowmFaMs0wPDQYK 29foBlXq4owPXRiwXPUjp+u6K7qDFmoA2WWHcVvmIO1ERu6FeRqo2G+iQEcVPlv4avfl 242g== X-Gm-Message-State: AElRT7Fe+b5MQhhlGsFedA6lmotENjUK7bFezJYsDk5SZe1rayV11SZS YqnG/ynrEIWK75US2XdHr7U= X-Google-Smtp-Source: AG47ELuQXX5Y7PvN98Ms8IAxOuijQX589j1sUgHIr3dZfqPk+SvwJwMAZJy88x153s/OfZKYFF43ZQ== X-Received: by 10.99.96.66 with SMTP id u63mr12493962pgb.22.1521559982306; Tue, 20 Mar 2018 08:33:02 -0700 (PDT) Received: from seema-Inspiron-15-3567.iiit.ac.in ([14.139.82.6]) by smtp.googlemail.com with ESMTPSA id j185sm3649369pgc.79.2018.03.20.08.32.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 20 Mar 2018 08:33:01 -0700 (PDT) From: Arushi Singhal To: boris.brezillon@free-electrons.com Subject: [PATCH v2 2/2] mtd: nand: Remove print after allocation failure Date: Tue, 20 Mar 2018 21:01:25 +0530 Message-Id: <1521559885-10523-2-git-send-email-arushisinghal19971997@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1521559885-10523-1-git-send-email-arushisinghal19971997@gmail.com> References: <1521559885-10523-1-git-send-email-arushisinghal19971997@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180320_083313_943232_83FF303A X-CRM114-Status: GOOD ( 16.41 ) X-Spam-Score: 0.1 (/) X-Spam-Report: SpamAssassin version 3.4.1 on bombadil.infradead.org summary: Content analysis details: (0.1 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [2607:f8b0:400e:c05:0:0:0:243 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (arushisinghal19971997[at]gmail.com) 0.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends in digit (arushisinghal19971997[at]gmail.com) -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 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: Arushi Singhal , richard@nod.at, miquel.raynal@free-electrons.com, linux-kernel@vger.kernel.org, nicolas.ferre@microchip.com, marek.vasut@gmail.com, linux-mtd@lists.infradead.org, rainyfeeling@outlook.com, alexandre.belloni@free-electrons.com, maxime.ripard@free-electrons.com, computersforpeace@gmail.com, dwmw2@infradead.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-mtd" Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org The prints after [k|v][m|z|c]alloc() etc. functions are not needed, because in case of failure, allocator will print their internal error prints anyway. Signed-off-by: Arushi Singhal Reviewed-by: Miquel Raynal Acked-by: Nicolas Ferre --- drivers/mtd/nand/ams-delta.c | 1 - drivers/mtd/nand/atmel/nand-controller.c | 13 +++--------- drivers/mtd/nand/marvell_nand.c | 8 ++------ drivers/mtd/nand/nandsim.c | 35 ++++++++------------------------ drivers/mtd/nand/ndfc.c | 4 +--- drivers/mtd/nand/sunxi_nand.c | 4 +--- 6 files changed, 15 insertions(+), 50 deletions(-) diff --git a/drivers/mtd/nand/ams-delta.c b/drivers/mtd/nand/ams-delta.c index 9de6572..6e7f6e0 100644 --- a/drivers/mtd/nand/ams-delta.c +++ b/drivers/mtd/nand/ams-delta.c @@ -185,7 +185,6 @@ static int ams_delta_init(struct platform_device *pdev) /* Allocate memory for MTD device structure and private data */ this = kzalloc(sizeof(struct nand_chip), GFP_KERNEL); if (!this) { - printk (KERN_WARNING "Unable to allocate E3 NAND MTD device structure.\n"); err = -ENOMEM; goto out; } diff --git a/drivers/mtd/nand/atmel/nand-controller.c b/drivers/mtd/nand/atmel/nand-controller.c index b2f00b3..b973d42 100644 --- a/drivers/mtd/nand/atmel/nand-controller.c +++ b/drivers/mtd/nand/atmel/nand-controller.c @@ -1615,10 +1615,8 @@ static int atmel_nand_register(struct atmel_nand *nand) mtd->name = devm_kasprintf(nc->dev, GFP_KERNEL, "%s:nand.%d", dev_name(nc->dev), nand->cs[0].id); - if (!mtd->name) { - dev_err(nc->dev, "Failed to allocate mtd->name\n"); + if (!mtd->name) return -ENOMEM; - } } ret = nand_scan_tail(mtd); @@ -1657,10 +1655,8 @@ static struct atmel_nand *atmel_nand_create(struct atmel_nand_controller *nc, nand = devm_kzalloc(nc->dev, sizeof(*nand) + (numcs * sizeof(*nand->cs)), GFP_KERNEL); - if (!nand) { - dev_err(nc->dev, "Failed to allocate NAND object\n"); + if (!nand) return ERR_PTR(-ENOMEM); - } nand->numcs = numcs; @@ -2217,11 +2213,8 @@ atmel_hsmc_nand_controller_init(struct atmel_hsmc_nand_controller *nc) nc->sram.virt = gen_pool_dma_alloc(nc->sram.pool, ATMEL_NFC_SRAM_SIZE, &nc->sram.dma); - if (!nc->sram.virt) { - dev_err(nc->base.dev, - "Could not allocate memory from the NFC SRAM pool\n"); + if (!nc->sram.virt) return -ENOMEM; - } return 0; } diff --git a/drivers/mtd/nand/marvell_nand.c b/drivers/mtd/nand/marvell_nand.c index 2196f2a..9dd2673 100644 --- a/drivers/mtd/nand/marvell_nand.c +++ b/drivers/mtd/nand/marvell_nand.c @@ -2307,10 +2307,8 @@ static int marvell_nand_chip_init(struct device *dev, struct marvell_nfc *nfc, (nsels * sizeof(struct marvell_nand_chip_sel)), GFP_KERNEL); - if (!marvell_nand) { - dev_err(dev, "could not allocate chip structure\n"); + if (!marvell_nand) return -ENOMEM; - } marvell_nand->nsels = nsels; marvell_nand->selected_die = -1; @@ -2506,10 +2504,8 @@ static int marvell_nand_chip_init(struct device *dev, struct marvell_nfc *nfc, mtd->name = devm_kasprintf(nfc->dev, GFP_KERNEL, "%s:nand.%d", dev_name(nfc->dev), marvell_nand->sels[0].cs); - if (!mtd->name) { - dev_err(nfc->dev, "Failed to allocate mtd->name\n"); + if (!mtd->name) return -ENOMEM; - } } ret = nand_scan_tail(mtd); diff --git a/drivers/mtd/nand/nandsim.c b/drivers/mtd/nand/nandsim.c index 44322a3..b6a5c09 100644 --- a/drivers/mtd/nand/nandsim.c +++ b/drivers/mtd/nand/nandsim.c @@ -569,13 +569,11 @@ static int __init alloc_device(struct nandsim *ns) ns->pages_written = vzalloc(BITS_TO_LONGS(ns->geom.pgnum) * sizeof(unsigned long)); if (!ns->pages_written) { - NS_ERR("alloc_device: unable to allocate pages written array\n"); err = -ENOMEM; goto err_close; } ns->file_buf = kmalloc(ns->geom.pgszoob, GFP_KERNEL); if (!ns->file_buf) { - NS_ERR("alloc_device: unable to allocate file buf\n"); err = -ENOMEM; goto err_free; } @@ -584,10 +582,8 @@ static int __init alloc_device(struct nandsim *ns) } ns->pages = vmalloc(ns->geom.pgnum * sizeof(union ns_mem)); - if (!ns->pages) { - NS_ERR("alloc_device: unable to allocate page array\n"); + if (!ns->pages) return -ENOMEM; - } for (i = 0; i < ns->geom.pgnum; i++) { ns->pages[i].byte = NULL; } @@ -769,11 +765,8 @@ static int __init init_nandsim(struct mtd_info *mtd) /* Allocate / initialize the internal buffer */ ns->buf.byte = kmalloc(ns->geom.pgszoob, GFP_KERNEL); - if (!ns->buf.byte) { - NS_ERR("init_nandsim: unable to allocate %u bytes for the internal buffer\n", - ns->geom.pgszoob); + if (!ns->buf.byte) return -ENOMEM; - } memset(ns->buf.byte, 0xFF, ns->geom.pgszoob); return 0; @@ -844,10 +837,8 @@ static int parse_weakblocks(void) if (*w == ',') w += 1; wb = kzalloc(sizeof(*wb), GFP_KERNEL); - if (!wb) { - NS_ERR("unable to allocate memory.\n"); + if (!wb) return -ENOMEM; - } wb->erase_block_no = erase_block_no; wb->max_erases = max_erases; list_add(&wb->list, &weak_blocks); @@ -895,10 +886,8 @@ static int parse_weakpages(void) if (*w == ',') w += 1; wp = kzalloc(sizeof(*wp), GFP_KERNEL); - if (!wp) { - NS_ERR("unable to allocate memory.\n"); + if (!wp) return -ENOMEM; - } wp->page_no = page_no; wp->max_writes = max_writes; list_add(&wp->list, &weak_pages); @@ -946,10 +935,8 @@ static int parse_gravepages(void) if (*g == ',') g += 1; gp = kzalloc(sizeof(*gp), GFP_KERNEL); - if (!gp) { - NS_ERR("unable to allocate memory.\n"); + if (!gp) return -ENOMEM; - } gp->page_no = page_no; gp->max_reads = max_reads; list_add(&gp->list, &grave_pages); @@ -1000,10 +987,8 @@ static int setup_wear_reporting(struct mtd_info *mtd) return -ENOMEM; } erase_block_wear = kzalloc(mem, GFP_KERNEL); - if (!erase_block_wear) { - NS_ERR("Too many erase blocks for wear reporting\n"); + if (!erase_block_wear) return -ENOMEM; - } return 0; } @@ -1558,10 +1543,8 @@ static int prog_page(struct nandsim *ns, int num) * again and deadlocks. This was seen in practice. */ mypage->byte = kmem_cache_alloc(ns->nand_pages_slab, GFP_NOFS); - if (mypage->byte == NULL) { - NS_ERR("prog_page: error allocating memory for page %d\n", ns->regs.row); + if (!mypage->byte) return -1; - } memset(mypage->byte, 0xFF, ns->geom.pgszoob); } @@ -2209,10 +2192,8 @@ static int __init ns_init_module(void) /* Allocate and initialize mtd_info, nand_chip and nandsim structures */ chip = kzalloc(sizeof(struct nand_chip) + sizeof(struct nandsim), GFP_KERNEL); - if (!chip) { - NS_ERR("unable to allocate core structures.\n"); + if (!chip) return -ENOMEM; - } nsmtd = nand_to_mtd(chip); nand = (struct nandsim *)(chip + 1); nand_set_controller_data(chip, (void *)nand); diff --git a/drivers/mtd/nand/ndfc.c b/drivers/mtd/nand/ndfc.c index d8a8068..ea8d652 100644 --- a/drivers/mtd/nand/ndfc.c +++ b/drivers/mtd/nand/ndfc.c @@ -223,10 +223,8 @@ static int ndfc_probe(struct platform_device *ofdev) dev_set_drvdata(&ofdev->dev, ndfc); ndfc->ndfcbase = of_iomap(ofdev->dev.of_node, 0); - if (!ndfc->ndfcbase) { - dev_err(&ofdev->dev, "failed to get memory\n"); + if (!ndfc->ndfcbase) return -EIO; - } ccr = NDFC_CCR_BS(ndfc->chip_select); diff --git a/drivers/mtd/nand/sunxi_nand.c b/drivers/mtd/nand/sunxi_nand.c index f5a55c6..f38359f7 100644 --- a/drivers/mtd/nand/sunxi_nand.c +++ b/drivers/mtd/nand/sunxi_nand.c @@ -2030,10 +2030,8 @@ static int sunxi_nand_chip_init(struct device *dev, struct sunxi_nfc *nfc, sizeof(*chip) + (nsels * sizeof(struct sunxi_nand_chip_sel)), GFP_KERNEL); - if (!chip) { - dev_err(dev, "could not allocate chip\n"); + if (!chip) return -ENOMEM; - } chip->nsels = nsels; chip->selected = -1;