diff options
author | Wei Yongjun <weiyongjun1@huawei.com> | 2018-08-29 14:20:07 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2018-08-31 08:23:30 +0200 |
commit | e2966de86640ca682a8c80b575202433e88f016b (patch) | |
tree | 503a0dc1dc27069fb363b49d1f450f25815700ed | |
parent | 004a53c87127e27b368a2c51c594f74d82eae5f2 (diff) | |
download | barebox-e2966de86640ca682a8c80b575202433e88f016b.tar.gz barebox-e2966de86640ca682a8c80b575202433e88f016b.tar.xz |
mtd: ubi: wl: Fix error return code in ubi_wl_init()
Fix to return error code -ENOMEM from the kmem_cache_alloc() error
handling case instead of 0, as done elsewhere in this function.
Fixes: f78e5623f45b ("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>
[Fixed conflicts]
Signed-off-by: Teresa Remmet <t.remmet@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r-- | drivers/mtd/ubi/wl.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/mtd/ubi/wl.c b/drivers/mtd/ubi/wl.c index 8d45b318f5..fa1b813702 100644 --- a/drivers/mtd/ubi/wl.c +++ b/drivers/mtd/ubi/wl.c @@ -1473,8 +1473,10 @@ int ubi_wl_init(struct ubi_device *ubi, struct ubi_attach_info *ai) list_for_each_entry(aeb, &ai->free, u.list) { e = kmalloc(sizeof(*e), GFP_KERNEL); - if (!e) + if (!e) { + err = -ENOMEM; goto out_free; + } e->pnum = aeb->pnum; e->ec = aeb->ec; @@ -1491,8 +1493,10 @@ int ubi_wl_init(struct ubi_device *ubi, struct ubi_attach_info *ai) ubi_rb_for_each_entry(rb1, av, &ai->volumes, rb) { ubi_rb_for_each_entry(rb2, aeb, &av->root, u.rb) { e = kmalloc(sizeof(*e), GFP_KERNEL); - if (!e) + if (!e) { + err = -ENOMEM; goto out_free; + } e->pnum = aeb->pnum; e->ec = aeb->ec; |