Skip to content

Commit 8626c40

Browse files
Wei Yongjungregkh
authored andcommitted
mtd: ubi: wl: Fix error return code in ubi_wl_init()
commit 7233982 upstream. Fix to return error code -ENOMEM from the kmem_cache_alloc() error handling case instead of 0, as done elsewhere in this function. Fixes: f78e562 ("ubi: fastmap: Erase outdated anchor PEBs during attach") Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com> Reviewed-by: Boris Brezillon <boris.brezillon@free-electrons.com> Signed-off-by: Richard Weinberger <richard@nod.at> Cc: Ben Hutchings <ben.hutchings@codethink.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 08fb833 commit 8626c40

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

drivers/mtd/ubi/wl.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1615,8 +1615,10 @@ int ubi_wl_init(struct ubi_device *ubi, struct ubi_attach_info *ai)
16151615
cond_resched();
16161616

16171617
e = kmem_cache_alloc(ubi_wl_entry_slab, GFP_KERNEL);
1618-
if (!e)
1618+
if (!e) {
1619+
err = -ENOMEM;
16191620
goto out_free;
1621+
}
16201622

16211623
e->pnum = aeb->pnum;
16221624
e->ec = aeb->ec;
@@ -1635,8 +1637,10 @@ int ubi_wl_init(struct ubi_device *ubi, struct ubi_attach_info *ai)
16351637
cond_resched();
16361638

16371639
e = kmem_cache_alloc(ubi_wl_entry_slab, GFP_KERNEL);
1638-
if (!e)
1640+
if (!e) {
1641+
err = -ENOMEM;
16391642
goto out_free;
1643+
}
16401644

16411645
e->pnum = aeb->pnum;
16421646
e->ec = aeb->ec;

0 commit comments

Comments
 (0)