]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.9.128/mtd-ubi-wl-fix-error-return-code-in-ubi_wl_init.patch
drop drm patch
[thirdparty/kernel/stable-queue.git] / releases / 4.9.128 / mtd-ubi-wl-fix-error-return-code-in-ubi_wl_init.patch
1 From 7233982ade15eeac05c6f351e8d347406e6bcd2f Mon Sep 17 00:00:00 2001
2 From: Wei Yongjun <weiyongjun1@huawei.com>
3 Date: Thu, 18 Jan 2018 14:05:05 +0000
4 Subject: mtd: ubi: wl: Fix error return code in ubi_wl_init()
5
6 From: Wei Yongjun <weiyongjun1@huawei.com>
7
8 commit 7233982ade15eeac05c6f351e8d347406e6bcd2f upstream.
9
10 Fix to return error code -ENOMEM from the kmem_cache_alloc() error
11 handling case instead of 0, as done elsewhere in this function.
12
13 Fixes: f78e5623f45b ("ubi: fastmap: Erase outdated anchor PEBs during
14 attach")
15 Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
16 Reviewed-by: Boris Brezillon <boris.brezillon@free-electrons.com>
17 Signed-off-by: Richard Weinberger <richard@nod.at>
18 Cc: Ben Hutchings <ben.hutchings@codethink.co.uk>
19 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
20
21 ---
22 drivers/mtd/ubi/wl.c | 8 ++++++--
23 1 file changed, 6 insertions(+), 2 deletions(-)
24
25 --- a/drivers/mtd/ubi/wl.c
26 +++ b/drivers/mtd/ubi/wl.c
27 @@ -1615,8 +1615,10 @@ int ubi_wl_init(struct ubi_device *ubi,
28 cond_resched();
29
30 e = kmem_cache_alloc(ubi_wl_entry_slab, GFP_KERNEL);
31 - if (!e)
32 + if (!e) {
33 + err = -ENOMEM;
34 goto out_free;
35 + }
36
37 e->pnum = aeb->pnum;
38 e->ec = aeb->ec;
39 @@ -1635,8 +1637,10 @@ int ubi_wl_init(struct ubi_device *ubi,
40 cond_resched();
41
42 e = kmem_cache_alloc(ubi_wl_entry_slab, GFP_KERNEL);
43 - if (!e)
44 + if (!e) {
45 + err = -ENOMEM;
46 goto out_free;
47 + }
48
49 e->pnum = aeb->pnum;
50 e->ec = aeb->ec;