summaryrefslogtreecommitdiff
path: root/drivers/mtd
diff options
context:
space:
mode:
authorHuang Shijie <b32955@freescale.com>2013-09-18 10:17:39 +0800
committerNitin Garg <nitin.garg@nxp.com>2016-01-14 11:02:38 -0600
commit61381999b1e0b1378da405c7196535e50c09f065 (patch)
treeb6cb0b43ff221c8f1935b601a0bd412269be410a /drivers/mtd
parentf21ddfdc339d49cdb244bc193d8b929acfeb05d5 (diff)
ENGR00279980 ubi: attach: do not return -EINVAL if the mtd->numeraseregions is 1
If the master mtd does not have any slave mtd partitions, and its numeraseregions is one(only has one erease block), and we attach the master mtd with : ubiattach -m 0 -d 0 We will meet the error: ------------------------------------------------------- root@freescale ~$ ubiattach /dev/ubi_ctrl -m 0 -d 0 UBI: attaching mtd0 to ubi0 UBI error: io_init: multiple regions, not implemented ubiattach: error!: cannot attach mtd0 error 22 (Invalid argument) ------------------------------------------------------- In fact, if there is only one "erase block", we should not prevent the attach. This patch fixes it. Signed-off-by: Huang Shijie <b32955@freescale.com> (cherry picked from commit 361cdc47fc4c4db31c5485560cdabd94f409bd81) (cherry picked from commit ebee7d74914fad3cf7223af84496811c9d2488a1)
Diffstat (limited to 'drivers/mtd')
-rw-r--r--drivers/mtd/ubi/build.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c
index b7f824d5ee88..852fc8bf2b33 100644
--- a/drivers/mtd/ubi/build.c
+++ b/drivers/mtd/ubi/build.c
@@ -641,7 +641,7 @@ static int io_init(struct ubi_device *ubi, int max_beb_per1024)
dbg_gen("sizeof(struct ubi_ainf_peb) %zu", sizeof(struct ubi_ainf_peb));
dbg_gen("sizeof(struct ubi_wl_entry) %zu", sizeof(struct ubi_wl_entry));
- if (ubi->mtd->numeraseregions != 0) {
+ if (ubi->mtd->numeraseregions > 1) {
/*
* Some flashes have several erase regions. Different regions
* may have different eraseblock size and other