From: Brian Norris <computersforpeace@gmail.com>
To: <linux-mtd@lists.infradead.org>
Cc: Brian Norris <computersforpeace@gmail.com>,
Artem Bityutskiy <dedekind1@gmail.com>
Subject: [PATCH 2/2] mtdinfo: fix `--all' for non-consecutive device numbers
Date: Fri, 27 Jan 2012 10:30:46 -0800 [thread overview]
Message-ID: <1327689046-1450-2-git-send-email-computersforpeace@gmail.com> (raw)
In-Reply-To: <1327689046-1450-1-git-send-email-computersforpeace@gmail.com>
When we have assigned non-consecutive device numbers to our MTD devices,
then we run `mtdinfo --all', we get errors once mtdinfo tries to process
the devices in the "hole". For instance, suppose that at boot time, we have
one MTD (/dev/mtd0) then perform a sequence like the following:
# modprobe mtdram
# modprobe nandsim
# rmmod mtdram
Then at this point, we have should have devices 0 and 2 without 1. Then:
# mtdinfo --all
...
mtdinfo: error!: mtd1 does not correspond to any existing MTD device
We add a check to first see if device is present, then continue to the next
ID if it doesn't exist.
Reported-by: Brian Foster <brian.foster@maxim-ic.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
---
ubi-utils/mtdinfo.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/ubi-utils/mtdinfo.c b/ubi-utils/mtdinfo.c
index ead4bce..d25595a 100644
--- a/ubi-utils/mtdinfo.c
+++ b/ubi-utils/mtdinfo.c
@@ -378,6 +378,8 @@ static int print_general_info(libmtd_t libmtd, const struct mtd_info *mtd_info,
for (i = mtd_info->lowest_mtd_num;
i <= mtd_info->highest_mtd_num; i++) {
+ if (!mtd_dev_present(libmtd, i))
+ continue;
err = print_dev_info(libmtd, mtd_info, i);
if (err)
return err;
--
1.7.5.4
next prev parent reply other threads:[~2012-01-27 18:30 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-27 18:30 [PATCH 1/2] libmtd: add `mtd_dev_present()' library function Brian Norris
2012-01-27 18:30 ` Brian Norris [this message]
2012-01-27 18:32 ` [PATCH 2/2] mtdinfo: fix `--all' for non-consecutive device numbers Brian Norris
2012-02-02 11:33 ` [PATCH 1/2] libmtd: add `mtd_dev_present()' library function Artem Bityutskiy
2012-02-02 13:20 ` Brian Foster
2012-02-03 9:17 ` Artem Bityutskiy
2012-02-08 21:28 ` Brian Norris
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=1327689046-1450-2-git-send-email-computersforpeace@gmail.com \
--to=computersforpeace@gmail.com \
--cc=dedekind1@gmail.com \
--cc=linux-mtd@lists.infradead.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 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.