From: Rajeev Kumar <rajeev_kumar@mentor.com>
To: <dwmw2@infradead.org>, <computersforpeace@gmail.com>
Cc: <dedekind1@gmail.com>, <richard@nod.at>,
<linux-mtd@lists.infradead.org>, <stable@vger.kernel.org>,
<rajeev_kumar@mentor.com>
Subject: [PATCH 2/2] ubi: attach: do not return -EINVAL if the mtd->numeraseregions is 1
Date: Mon, 25 Jul 2016 15:16:59 +0530 [thread overview]
Message-ID: <1469440019-29358-2-git-send-email-rajeev_kumar@mentor.com> (raw)
In-Reply-To: <1469440019-29358-1-git-send-email-rajeev_kumar@mentor.com>
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 ~$ 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 is tested against 3.14 kernel and only build test is
performed against current upstream master branch.
Signed-off-by: Rajeev Kumar <rajeev_kumar@mentor.com>
---
drivers/mtd/ubi/build.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c
index 59229c4..562421b 100644
--- a/drivers/mtd/ubi/build.c
+++ b/drivers/mtd/ubi/build.c
@@ -628,7 +628,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.9.5
next prev parent reply other threads:[~2016-07-25 9:47 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-25 9:46 [PATCH 1/2] MTD: UBI: speed up init by moving status messages to debugfs Rajeev Kumar
2016-07-25 9:46 ` Rajeev Kumar [this message]
2016-07-25 10:31 ` [PATCH 2/2] ubi: attach: do not return -EINVAL if the mtd->numeraseregions is 1 Richard Weinberger
2016-07-25 11:16 ` Rajeev Kumar
2016-07-25 11:20 ` Richard Weinberger
2016-07-29 18:24 ` Brian Norris
2016-08-04 6:30 ` Artem Bityutskiy
2016-09-23 11:20 ` Chugh, Sanjeev
2016-09-23 11:37 ` Chugh, Sanjeev
2016-10-26 12:26 ` Chugh, Sanjeev
2016-07-25 10:31 ` [PATCH 1/2] MTD: UBI: speed up init by moving status messages to debugfs Richard Weinberger
2016-07-25 11:23 ` Rajeev Kumar
2016-07-25 11:32 ` Richard Weinberger
2016-07-25 16:47 ` Greg KH
2016-07-25 20:39 ` Richard Weinberger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1469440019-29358-2-git-send-email-rajeev_kumar@mentor.com \
--to=rajeev_kumar@mentor.com \
--cc=computersforpeace@gmail.com \
--cc=dedekind1@gmail.com \
--cc=dwmw2@infradead.org \
--cc=linux-mtd@lists.infradead.org \
--cc=richard@nod.at \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).