mtd: maps: physmap: Return -ENOMEM directly when info allocation fails
authorBoris Brezillon <boris.brezillon@bootlin.com>
Fri, 19 Oct 2018 07:49:01 +0000 (09:49 +0200)
committerBoris Brezillon <boris.brezillon@bootlin.com>
Mon, 5 Nov 2018 21:24:10 +0000 (22:24 +0100)
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 <boris.brezillon@bootlin.com>
Reviewed-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
drivers/mtd/maps/physmap.c

index 9b34223c4635561d766a75966735bb4d92b771b3..7d30f3524d35b5ead7d374d624717c44a279eb09 100644 (file)
@@ -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++;