From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.bootlin.com ([62.4.15.54]) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1g9brt-0006B0-0Z for linux-mtd@lists.infradead.org; Mon, 08 Oct 2018 20:11:14 +0000 From: Boris Brezillon To: David Woodhouse , Brian Norris , Boris Brezillon , Marek Vasut , Richard Weinberger , linux-mtd@lists.infradead.org Cc: Rob Herring , Pawel Moll , Mark Rutland , Ian Campbell , Kumar Gala , devicetree@vger.kernel.org, Ricardo Ribalda Delgado Subject: [PATCH 08/14] mtd: maps: physmap: Return -ENOMEM directly when info allocation fails Date: Mon, 8 Oct 2018 22:10:21 +0200 Message-Id: <20181008201027.17952-9-boris.brezillon@bootlin.com> In-Reply-To: <20181008201027.17952-1-boris.brezillon@bootlin.com> References: <20181008201027.17952-1-boris.brezillon@bootlin.com> List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , There's no point going to the err_out path since no resources have been allocated yet, just return -ENOMEM directly. Signed-off-by: Boris Brezillon --- drivers/mtd/maps/physmap.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/mtd/maps/physmap.c b/drivers/mtd/maps/physmap.c index 9b34223c4635..7d30f3524d35 100644 --- a/drivers/mtd/maps/physmap.c +++ b/drivers/mtd/maps/physmap.c @@ -110,10 +110,8 @@ static int physmap_flash_probe(struct platform_device *dev) info = devm_kzalloc(&dev->dev, sizeof(struct physmap_flash_info), GFP_KERNEL); - if (info == NULL) { - err = -ENOMEM; - goto err_out; - } + if (!info) + return -ENOMEM; while (platform_get_resource(dev, IORESOURCE_MEM, info->nmaps)) info->nmaps++; -- 2.14.1