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 1gDPXV-0003Sb-FY for linux-mtd@lists.infradead.org; Fri, 19 Oct 2018 07:50:10 +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 , Linus Walleij Subject: [PATCH v2 08/15] mtd: maps: physmap: Return -ENOMEM directly when info allocation fails Date: Fri, 19 Oct 2018 09:49:01 +0200 Message-Id: <20181019074908.13226-9-boris.brezillon@bootlin.com> In-Reply-To: <20181019074908.13226-1-boris.brezillon@bootlin.com> References: <20181019074908.13226-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 Reviewed-by: Ricardo Ribalda Delgado --- Changes in v2: - Add Ricardo's R-b --- 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