UBI: return -ENOMEM upon failing vmalloc
authorStefan Roese <sr@denx.de>
Wed, 10 Dec 2008 09:42:54 +0000 (10:42 +0100)
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Wed, 10 Dec 2008 12:28:48 +0000 (14:28 +0200)
Return with correct error code (-ENOMEM) from ubi_attach_mtd_dev() upon
failing vmalloc().

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

index c7630a2283109a39d8289cf114f748bd9770cd8f..ba0bd3d5775be9933a0e3da5e15cf8caf366bf6d 100644 (file)
@@ -815,19 +815,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);