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>
This commit is contained in:
parent
2d2e05727f
commit
8173293516
|
@ -784,19 +784,20 @@ int ubi_attach_mtd_dev(struct mtd_info *mtd, int ubi_num, int vid_hdr_offset)
|
||||||
if (err)
|
if (err)
|
||||||
goto out_free;
|
goto out_free;
|
||||||
|
|
||||||
|
err = -ENOMEM;
|
||||||
ubi->peb_buf1 = vmalloc(ubi->peb_size);
|
ubi->peb_buf1 = vmalloc(ubi->peb_size);
|
||||||
if (!ubi->peb_buf1)
|
if (!ubi->peb_buf1)
|
||||||
goto out_free;
|
goto out_free;
|
||||||
|
|
||||||
ubi->peb_buf2 = vmalloc(ubi->peb_size);
|
ubi->peb_buf2 = vmalloc(ubi->peb_size);
|
||||||
if (!ubi->peb_buf2)
|
if (!ubi->peb_buf2)
|
||||||
goto out_free;
|
goto out_free;
|
||||||
|
|
||||||
#ifdef CONFIG_MTD_UBI_DEBUG
|
#ifdef CONFIG_MTD_UBI_DEBUG
|
||||||
mutex_init(&ubi->dbg_buf_mutex);
|
mutex_init(&ubi->dbg_buf_mutex);
|
||||||
ubi->dbg_peb_buf = vmalloc(ubi->peb_size);
|
ubi->dbg_peb_buf = vmalloc(ubi->peb_size);
|
||||||
if (!ubi->dbg_peb_buf)
|
if (!ubi->dbg_peb_buf)
|
||||||
goto out_free;
|
goto out_free;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
err = attach_by_scanning(ubi);
|
err = attach_by_scanning(ubi);
|
||||||
|
|
Loading…
Reference in New Issue