kernel: bump 5.4 to 5.4.66
[openwrt/openwrt.git] / target / linux / layerscape / patches-5.4 / 303-core-0008-ENGR00279980-ubi-attach-do-not-return-EINVAL-if-the-.patch
1 From 17e6b7bb84649ffcbec11b3e3e933294d8856462 Mon Sep 17 00:00:00 2001
2 From: Huang Shijie <b32955@freescale.com>
3 Date: Wed, 18 Sep 2013 10:17:39 +0800
4 Subject: [PATCH] ENGR00279980 ubi: attach: do not return -EINVAL if the
5 mtd->numeraseregions is 1
6
7 If the master mtd does not have any slave mtd partitions,
8 and its numeraseregions is one(only has one erease block), and
9 we attach the master mtd with : ubiattach -m 0 -d 0
10
11 We will meet the error:
12 -------------------------------------------------------
13 root@freescale ~$ ubiattach /dev/ubi_ctrl -m 0 -d 0
14 UBI: attaching mtd0 to ubi0
15 UBI error: io_init: multiple regions, not implemented
16 ubiattach: error!: cannot attach mtd0
17 error 22 (Invalid argument)
18 -------------------------------------------------------
19
20 In fact, if there is only one "erase block", we should not
21 prevent the attach.
22
23 This patch fixes it.
24
25 Signed-off-by: Huang Shijie <b32955@freescale.com>
26 (cherry picked from commit 361cdc47fc4c4db31c5485560cdabd94f409bd81)
27 (cherry picked from commit ebee7d74914fad3cf7223af84496811c9d2488a1)
28
29 Signed-off-by: Vipul Kumar <vipul_kumar@mentor.com>
30
31 Signed-off-by: Han Xu <han.xu@nxp.com>
32 ---
33 drivers/mtd/ubi/build.c | 2 +-
34 1 file changed, 1 insertion(+), 1 deletion(-)
35
36 --- a/drivers/mtd/ubi/build.c
37 +++ b/drivers/mtd/ubi/build.c
38 @@ -576,7 +576,7 @@ static int io_init(struct ubi_device *ub
39 dbg_gen("sizeof(struct ubi_ainf_peb) %zu", sizeof(struct ubi_ainf_peb));
40 dbg_gen("sizeof(struct ubi_wl_entry) %zu", sizeof(struct ubi_wl_entry));
41
42 - if (ubi->mtd->numeraseregions != 0) {
43 + if (ubi->mtd->numeraseregions > 1) {
44 /*
45 * Some flashes have several erase regions. Different regions
46 * may have different eraseblock size and other