]> git.sur5r.net Git - u-boot/commitdiff
UBI: Return -ENOMEM upon failing malloc
authorStefan Roese <sr@denx.de>
Wed, 10 Dec 2008 09:28:33 +0000 (10:28 +0100)
committerStefan Roese <sr@denx.de>
Wed, 10 Dec 2008 11:55:23 +0000 (12:55 +0100)
Return with correct error code (-ENOMEM) from ubi_attach_mtd_dev() upon
failing malloc().

Signed-off-by: Stefan Roese <sr@denx.de>
drivers/mtd/ubi/build.c

index bdf75c98a1635cdf1a187210428ee1f1810230ea..f4b01a9ded249adb84d6387e72633d53b1095a4a 100644 (file)
@@ -784,19 +784,20 @@ int ubi_attach_mtd_dev(struct mtd_info *mtd, int ubi_num, int vid_hdr_offset)
        if (err)
                goto out_free;
 
+       err = -ENOMEM;
        ubi->peb_buf1 = vmalloc(ubi->peb_size);
        if (!ubi->peb_buf1)
                goto out_free;
 
        ubi->peb_buf2 = vmalloc(ubi->peb_size);
        if (!ubi->peb_buf2)
-                goto out_free;
+               goto out_free;
 
 #ifdef CONFIG_MTD_UBI_DEBUG
        mutex_init(&ubi->dbg_buf_mutex);
        ubi->dbg_peb_buf = vmalloc(ubi->peb_size);
        if (!ubi->dbg_peb_buf)
-                goto out_free;
+               goto out_free;
 #endif
 
        err = attach_by_scanning(ubi);