summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorStefan Roese <sr@denx.de>2008-12-10 10:28:33 +0100
committerStefan Roese <sr@denx.de>2008-12-10 12:55:23 +0100
commit817329351639a8895cd9b87b33aeff043f3d5a44 (patch)
treebd1ec35c528060bffbc662218cd728e177665cf6 /drivers
parent2d2e05727fe4013f807ffa814dff0e75259a1db4 (diff)
downloadu-boot-imx-817329351639a8895cd9b87b33aeff043f3d5a44.zip
u-boot-imx-817329351639a8895cd9b87b33aeff043f3d5a44.tar.gz
u-boot-imx-817329351639a8895cd9b87b33aeff043f3d5a44.tar.bz2
UBI: Return -ENOMEM upon failing malloc
Return with correct error code (-ENOMEM) from ubi_attach_mtd_dev() upon failing malloc(). Signed-off-by: Stefan Roese <sr@denx.de>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/mtd/ubi/build.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c
index bdf75c9..f4b01a9 100644
--- a/drivers/mtd/ubi/build.c
+++ b/drivers/mtd/ubi/build.c
@@ -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);