All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH resend] ubi: attach: do not return -EINVAL if the mtd->numeraseregions is 1
@ 2014-02-14  8:08 Huang Shijie
  2014-02-14  9:18 ` Artem Bityutskiy
  0 siblings, 1 reply; 5+ messages in thread
From: Huang Shijie @ 2014-02-14  8:08 UTC (permalink / raw)
  To: dedekind1; +Cc: Huang Shijie, linux-mtd

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 with (Micron M29W256GL7AN6):
-------------------------------------------------------
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>
---
 drivers/mtd/ubi/build.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c
index 57deae9..a5edc64 100644
--- a/drivers/mtd/ubi/build.c
+++ b/drivers/mtd/ubi/build.c
@@ -640,7 +640,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
-- 
1.7.2.rc3

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-02-19 12:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-14  8:08 [PATCH resend] ubi: attach: do not return -EINVAL if the mtd->numeraseregions is 1 Huang Shijie
2014-02-14  9:18 ` Artem Bityutskiy
2014-02-14  9:11   ` Huang Shijie
2014-02-14 11:22     ` Artem Bityutskiy
2014-02-19 11:40       ` Huang Shijie

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.