diff options
author | Boris Brezillon <boris.brezillon@bootlin.com> | 2018-10-19 10:49:01 +0300 |
---|---|---|
committer | Boris Brezillon <boris.brezillon@bootlin.com> | 2018-11-06 00:24:10 +0300 |
commit | 7abe5309de76337920f103d9e34ebd42a479533b (patch) | |
tree | ff88d1e140abdbbfa5e29c7404727acf549fbbc3 | |
parent | 1e4f42084910067b2d37002afb6d1d1413552e1c (diff) | |
download | linux-7abe5309de76337920f103d9e34ebd42a479533b.tar.xz |
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>
-rw-r--r-- | drivers/mtd/maps/physmap.c | 6 |
1 files 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++; |