[BUG] mtdinfo -a: Tries to open NULL pointer for NOR with Eraseblock Regions

Brian Foster brian.foster at maxim-ic.com
Tue Aug 9 03:27:12 EDT 2011


On Tuesday 09 August 2011 01:19:11 Brian Norris wrote:
> On Fri, Aug 5, 2011 at 6:18 PM, Mike Frysinger <vapier at gentoo.org> wrote:
>[ ... ]
> > alternatively, we punt --all and just make users run `mtdinfo
> > /dev/mtd?`.  i'm fine with that too.
> 
> I also feel like `--all' is too valuable to be killed just because
> of region_info.
> 
> Instead, I'm a little more inclined to go for Brian Foster's
> suggestion (from another branch of this thread):
> 
>   "Alternatively, --all only prints what it can get,
>   and --help warns there _may_ be additional data not
>   printed by --all (and to use ‘mtdinfo /dev/mtd<N>’)."
> 
> Only problem I see is that this provides a little bit of
> inconsistency, where `mtdinfo --all' isn't quite all the info.
> But with an addition help message as described by Mr. Foster,
> I don't think this would be much problem.

 Thanks.  I've always presumed ‘--all’ means “all mtd devices”,
 not “all info from mtd”, so this seeming-inconsistency didn't
 even occur to me!  If you want “all info from mtd”, then just
 do something like:
────────────────────────────────────────────────────────────────
# for m in /dev/mtd[0-9]*; do mtdinfo $m; done
mtd0
Name:                           physmap-flash.0
Type:                           nor
Eraseblock size:                131072 bytes, 128.0 KiB
Amount of eraseblocks:          256 (33554432 bytes, 32.0 MiB)
Minimum input/output unit size: 1 byte
Sub-page size:                  1 byte
Additional erase regions:       0
Character device major/minor:   90:0
Bad blocks are allowed:         false
Device is writable:             true
Eraseblock region 0:  offset: 0x27f0004 size: 0xde numblocks: 0

mtdinfo: error!: "/dev/mtd1" does not correspond to any existing MTD device
mtdinfo: error!: "/dev/mtd2" does not correspond to any existing MTD device
mtdinfo: error!: "/dev/mtd3" does not correspond to any existing MTD device
mtdinfo: error!: "/dev/mtd4" does not correspond to any existing MTD device
mtdinfo: error!: "/dev/mtd5" does not correspond to any existing MTD device
mtdinfo: error!: "/dev/mtd6" does not correspond to any existing MTD device
mtdinfo: error!: "/dev/mtd7" does not correspond to any existing MTD device
# 
────────────────────────────────────────────────────────────────
 Simple.  I don't mind the errors shown above, so I haven't
 bothered to work out how to suppress them (without loosing
 other, presumably important, error messages).

cheers!
	-blf-
-- 
Brian FOSTER
Principal MTS, Software
Maxim Integrated Products (Microcontroller BU), formerly Innova Card
Web    : http://www.maxim-ic.com/



More information about the linux-mtd mailing list