Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mtd: maps: physmap: Return -ENOMEM directly when info allocation fails

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>

+2 -4
+2 -4
drivers/mtd/maps/physmap.c
··· 110 110 111 111 info = devm_kzalloc(&dev->dev, sizeof(struct physmap_flash_info), 112 112 GFP_KERNEL); 113 - if (info == NULL) { 114 - err = -ENOMEM; 115 - goto err_out; 116 - } 113 + if (!info) 114 + return -ENOMEM; 117 115 118 116 while (platform_get_resource(dev, IORESOURCE_MEM, info->nmaps)) 119 117 info->nmaps++;