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; }