From: Stefan Roese Date: Wed, 10 Dec 2008 09:42:54 +0000 (+0100) Subject: UBI: return -ENOMEM upon failing vmalloc X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=ad5942bad6addcf9697a74413b517d9724d803a4;p=linux-beck.git UBI: return -ENOMEM upon failing vmalloc Return with correct error code (-ENOMEM) from ubi_attach_mtd_dev() upon failing vmalloc(). Signed-off-by: Stefan Roese Signed-off-by: Artem Bityutskiy --- diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c index c7630a228310..ba0bd3d5775b 100644 --- a/drivers/mtd/ubi/build.c +++ b/drivers/mtd/ubi/build.c @@ -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);