aboutsummaryrefslogtreecommitdiff
path: root/ubi-utils
AgeCommit message (Collapse)Author
2019-11-10ubiformat: don't leak file descriptorsDavid Oberhollenzer
The original code had a 'goto out_close' directly after a return error code, which is obviously not what was intended. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-10-07ubihealthd: Add option -h/--helpAlexander Dahl
Using '?' as option did not work, and would be strange to pass anyway, because it's a glob char for the shell and you would have to escape it like ./ubihealthd -\? … use the more common -h/--help instead. Note: this does not touch the output, just changes the options itself. Signed-off-by: Alexander Dahl <post@lespocky.de> Acked-by: Richard Weinberger <richard@nod.at> Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-10-07ubihealthd: Add missing sentinel in options arrayAlexander Dahl
`getopt_long()` requires a null terminated array, otherwise we get segfaults when passing invalid options. Fixes: 7f0e2dc21fb2 ("ubi-utils: Implement a ubihealthd") Signed-off-by: Alexander Dahl <post@lespocky.de> Acked-by: Richard Weinberger <richard@nod.at> Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-09-10ubiupdatevol: Prevent null pointer dereferenceBastian Germann
libubi_close(libubi) is called in the error handler if libubi is null. Prevent that by handling the error case similar to the other ubi executables. Signed-off-by: Bastian Germann <bastiangermann@fishpost.de> Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-08-25ubi-utils: Implement a ubihealthdRichard Weinberger
ubihealthd is a simple daemon which scans every PEB of an UBI device in random order. It helps to deal with read disturb on systems which either reboot seldom, use fastmap or read few data. To use this daemon you need Linux >= v5.1. Signed-off-by: Richard Weinberger <richard@nod.at>
2019-07-02ubinize: Exit with non-zero exit code on error.Patrick Doyle
...specifically -1 in all of the new cases. Signed-off-by: Patrick Doyle <pdoyle@irobot.com> Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-05-13ubiformat: Dont ignore sequence number CLI optionAmol Vengurlekar
Image sequence number for the UBI header can be specified for the ubiformat tool according to the documentation and the help message for ubiformat. The CLI option --image-seq for image sequence number is not supported. -Q option for image sequence number is silently ignored. This patch adds the CLI support for image sequence number. Signed-off-by: Amol Vengurlekar <amol.sven@gmail.com> Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2019-01-25mtd-utils: avoid to create two UBI_LAYOUT_VOLUME_ID volumeYufen Yu
When we create a ubi image by ubinize, a UBI_LAYOUT_VOLUME_ID volume will be created by ubigen_write_layout_vol(). However, after the commit 4c00cf2c5816 (ubiformat: remove no-volume-table option), ubiformat remove novtbl args in format(). As a result, it will also create a layout volume. When we attempt to do ubiattach, it will fail for ubi_compare_lebs error: ubi0 error: ubi_compare_lebs: unsupported on-flash UBI format ubi0 error: ubi_attach_mtd_dev: failed to attach mtd1, error -22 Signed-off-by: Yufen Yu <yuyufen@huawei.com> Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2018-07-27ubi-utils: ubimkvol: Initialize req to zero to make sure no flags are set by ↵Boris Brezillon
default The program expects req.flags to be zero-initialized, but it's not the case. Let's explicitly initialize req to zero at declaration time. Fixes: 7b4a65a27d26 ("ubi-utils: ubimkvol: add support for skipping CRC check of a static volume when opening") Reviewed-by: Quentin Schulz <quentin.schulz@bootlin.com> Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com> Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2018-06-28ubi-utils: ubinize: add support for skipping CRC check of a static volume ↵Quentin Schulz
when opening Let's let the user configure static UBI volume with CRC checking at opening disabled if desired. Introduce the skip-check setting for vol_flags configuration of a volume. There is no point in having both autoresize and skip-check set as skip-check is reserved for static volumes only and it's useless to have a static volume's size set to autoresize. Suggested-by: Boris Brezillon <boris.brezillon@bootlin.com> Reviewed-by: Boris Brezillon <boris.brezillon@bootlin.com> Signed-off-by: Quentin Schulz <quentin.schulz@bootlin.com> Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2018-06-28ubi-utils: ubimkvol: add support for skipping CRC check of a static volume ↵Quentin Schulz
when opening Let's let the user create static UBI volume with CRC checking at opening disabled if desired. Introduce the `--skipcheck` or `-k` option for such feature. Suggested-by: Boris Brezillon <boris.brezillon@bootlin.com> Reviewed-by: Boris Brezillon <boris.brezillon@bootlin.com> Signed-off-by: Quentin Schulz <quentin.schulz@bootlin.com> Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2018-05-12ubiformat: remove no-volume-table optionDavid Oberhollenzer
Using the -n or --no-volume-table flags, ubiformat can format an mtd device to a broken UBI that does not attach on recent kernel. Only very old UBIs had no volume table. This patch removes the option entirely from ubiformat. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2018-05-12ubiformat: process command line arguments firstDavid Oberhollenzer
If libmtd_open fails, the program always exists with failure status and prints "MTD subsystem is not present". Even `ubiformat --help` produces the same result, which is definitely undesired. This patch moves command line option processing first to get the desired behavior. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2018-01-30ubi-utils: ubiformat.c: convert to integer arithmeticAndrea Adami
Do not cast percent to double, it is just used as upper limit. Avoid floating point to fix compilation for aarch64 against klibc: error: '-mgeneral-regs-only' is incompatible with floating-point code | int percent = ((double)si->ok_cnt)/si->good_cnt * 100; | ^~~~~~~ Notes: * The checks in the code above this line ensure that si->good_cnt is not 0. * The code assumes si->good_cnt * 100 will not overflow, then we can use (si->ok_cnt * 100) safely because the former is bigger. * The truncated result does not affect the logic: i.e. a value of 49.9 is truncated to 49 and is still <50. Signed-off-by: Andrea Adami <andrea.adami@gmail.com> Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2017-11-03ubi-utils: ubicrc32: process command line arguments firstDavid Oberhollenzer
When a command line option is used (e.g. --version), the tool tries to open it as a file first, then *uppon success* attempts to process the command line options (including what it assumed to be an input file) which is obviously broken. This patch moves command line processing first and then attempts to open *the first unprocessed* argument. Reported-by: Uwe Kleine-König <ukleinek@debian.org> Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2017-11-02Mark or fix switch cases that fall throughDavid Oberhollenzer
Now that C++17 introduced a special fallthrough keyword for explicitly tagging switch cases that are supposed to fall through, newer gcc versions also implement a feature request from 2002 to warn about maybe unwanted fall-throughs in switch cases in other languages (like C). For C code, we can either add a gcc specific attribute at the end of the switch case, or use a special comment that gcc checks for, indicating that the fall-through behaviour is indeed intended. This patch adds a "/* fall-through */" comment at the end of various case blocks to silence gcc warnings and in some cases a break, where fall-through was probably not intended. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2017-08-10mtd-utils: ubinfo: add parameter checkAaron Marcher
Adds a check if the UBI device number is specified when passing a volume name as parameter. This fixes an issue, where by default an inexistent UBI device named "ubi-1" is selected because of missing checks. Signed-off-by: Aaron Marcher <me@drkhsh.at> Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2017-06-14ubi-utils: Return error code if command line option is unknownDaniel Wagner
The tools in question will quit with an exit code 0 if the command line option was not recognized. By returning an error code a calling script has the possibility to distinguish between a real success and an invalid invocation. We need to return -1 instead of EXIT_FAILURE to be consistent with the other exit code places. Signed-off-by: Daniel Wagner <daniel.wagner@siemens.com> Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2017-03-15Fix libmtd behaviour if MTD is not present on the systemDavid Oberhollenzer
The documentation of libmtd_open says, if it returns NULL and errno is zero, MTD is not present. However, the current version always returns a libmtd_t object. The function internally checks, if it can access the MTD sysfs files and, if not, sets a flag to use the procfs fallback. This patch adds an additional check to libmtd_open, to test if the MTD procfs file can be read and fails with errno cleared if it does not exist. Furhtermore, mtd_get_info is documented to fail with errno set to ENODEV if MTD is not present. First of all, this was broken in the original version. It was implemented to specification for the sysfs code path, but if MTD is not present, that won't be executed, because of the flag set by libmtd_open. This makes the check not only redundant, but masks an actual error (the sysfs paths suddenly not being readable anymore). The legacy path that was used if the sysfs files are not avaible fails with ENOENT if it cannot read the procfs file. With the above changes in addition, we don't have a libmtd_t object if neither sysfs nor procfs is readable, so this error status no longer makes sense. This patch removes the documentation on the ENODEV errno, and makes sure that mtd_get_info always returns with apropriate errno on failure. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2017-02-20ubirename: trivial fixes to the help textLuca Ceresoli
Add a missing space after PROGRAM_NAME and fix a typo. Signed-off-by: Luca Ceresoli <luca@lucaceresoli.net> Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2016-11-17Move ubi-utils libraries to common library locationDavid Oberhollenzer
Historically, the mtd-utils and ubi-utils were seperate packages. The ubi-utils were at some point merged into the mtd-utils. They first appeared in the release tar-ball in version 1.1.0 in their own sub-hirarchy with their own buildsystem, readme, documentation, etc. A lot of the duplicated stuff got centralized/removed over time. This patch further cleans up the directory hirarchy duplication by moving common libraries from the ubi-utils/ into the central lib/ and include/ directories in the top directory of the mtd-utils package. This includes: - libuib.a & libubigen.a used by the ubi utilities - libscan.a currently only used by ubiformat - libiniparser.a used by ubinize Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2016-11-17Merge rest of ubiutils-common into libmtd commonDavid Oberhollenzer
This patch moves the remaining 3 functions from ubiutils-common.{c,h} into libmtd common.{c,h}. The functions are only generic utility functions that other mtd-utils programs may also find usefull and every program that uses libubi links against libmtd anyway so there is no real reason for keeping around a seperate ubiutils-common with only generic helper functions. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2016-11-17Remove unused ubiutils_print_text from ubi-utils commonDavid Oberhollenzer
The function ubiutils_print_text was previously used by ubinize to pretty-print parts of the help text. Since the help text has been moved to a man page, the function is no longer used/needed. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2016-11-17Add ubinize manpageDavid Oberhollenzer
This patch removes the lengthy help text from the ubinize utility that attempted to describte the file format and every minor detail, and reformats it into a more readable man page. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
2016-11-17Add support for sysfs mockingDaniel Walter
In order to use test files, allow sysfs root to be set during compile time Signed-off-by: Daniel Walter <dwalter@sigma-star.at>
2016-11-17Change build system to autotoolsRichard Weinberger
This patch is largely based on Richards original RFC. The major differences to the RFC patch are: - Add missing sumtools & mtdpart targets - Fix name of mkfs.jffs2 target - Add missing subdir-objects option for non-recursive make - Move all automake options to configure.ac - Add manpages to install target - Make XATTR & LZO support configurable - Install binaries to sbin directory like in the old build system - Install flash_erase wrapper script - Add files missing from distribution target Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at> Signed-off-by: Richard Weinberger <richard@nod.at>
2015-09-29mtd-utils: ubinize: Always return error code (at least -1) in case of an errorEnrico Jorns
ubinize should not fail silenty, this can be very annoying when using it from other tools that rely on the exit code for determining the success of their operation. Signed-off-by: Enrico Jorns <ejo@pengutronix.de> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2015-07-06mtd-utils: fix 'new blank line at EOF' problemsDongsheng Yang
Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2015-07-06mtd-utils: fix the trailing whitespace problemsDongsheng Yang
Signed-off-by: Dongsheng Yang <yangds.fnst@cn.fujitsu.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2014-11-04libmtd: don't ignore "region index" parameter in mtd_regioninfo()Brian Norris
ioctl(MEMGETREGIONINFO) has one input parameter (regionindex) and three output parameters (info about the erase region). There are two problems in mtdinfo/libmtd here: 1. mtdinfo.c doesn't initialize its region_info_user struct, instead passing uninitialized data to mtd_regioninfo() 2. mtd_regioninfo() fails to utilize the 'regidx' parameter to fill out the regionindex parameter properly, so the garbage from mtdinfo.c is propagated to the ioctl() This means that mtdinfo will continuously probe the same (possibly out-of-range) erase region, instead of looping over the valid regions. Let's fix this in the mtd_regioninfo() helper, and at the same time, let's zero out the mtdinfo.c buffer, as an additional precaution to keep from using uninitialized data. Initial error report from Yang, when running "mtdinfo /dev/mtd0" on a Cavium 6100 board: root@CN61XX:~# mtdinfo /dev/mtd0 mtd0 Name: phys_mapped_flash Type: nor Eraseblock size: 65536 bytes, 64.0 KiB Amount of eraseblocks: 128 (8388608 bytes, 8.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 libmtd: error!: MEMGETREGIONINFO ioctl failed for erase region 0 error 22 (Invalid argument) Eraseblock region 0: info is unavailable libmtd: error!: MEMGETREGIONINFO ioctl failed for erase region 1 error 22 (Invalid argument) Eraseblock region 1: info is unavailable Reported-by: Yang Wei <Wei.Yang@windriver.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2014-09-16ubiformat: fix the subpage size hint on the error pathArtem Bityutskiy
David Binderman <dcb314@hotmail.com> reports that the following piece of looks wrong: if (!args.subpage_size != mtd->min_io_size) normsg("may be sub-page size is incorrect?"); I totally agree with him and I believe that we actually meant to have no negation in fron to f 'args.subpage_size', so instead, the code should look like this: if (args.subpage_size != mtd->min_io_size) normsg("may be sub-page size is incorrect?"); Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
2014-04-07ubiformat: correct "non-ubifs" warning messageBrian Norris
UBI's raw flash scan actually scans for UBI data, not UBIFS data (there *are* UBI users that are not UBIFS!), so correct the warning message. This also matches the comment in libscan.h. Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
2014-03-31ubi-utils: Fix file descriptor leaks in libubiDaniel van Gerpen
Amended by Artem. Signed-off-by: Daniel van Gerpen <daniel@vangerpen.de> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
2014-03-25ubi-utils: Add ubiblock toolEzequiel Garcia
With the addition of block device access to UBI volumes, we now add a simple userspace tool to access the new ioctls. Usage of this tool is as simple as it gets: $ ubiblock --create /dev/ubi0_0 will create a new block device /dev/ubiblock0_0, and $ ubiblock --remove /dev/ubi0_0 will remove the device. Artem: slightly changed the header comment. Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
2013-10-22check the MLC nand typeHuang Shijie
In the current code, the MTD_NANDFLASH stands for both the SLC and MLC. In the kernel, the MTD_NANDFLASH only stands for the SLC now, so in order to keep the logic unchanged, we should also check the MLC NAND by MTD_MLCNANDFLASH. Signed-off-by: Huang Shijie <b32955@freescale.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
2013-07-01ubiupdatevol: add a --skip optionMike Frysinger
This already has a --size option for controlling how many bytes to read from the input. Add a --skip option to control the offset into the input too. This way people don't have to do `dd | ubiupdatevol`. While we're here, I've fixed the types used with args.size and the read loop so that they can hold the right sizes (like setting a 32bit+ size). Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
2013-07-01mtd-utils: new prompt() helper for talking to the userMike Frysinger
We've got a few tools that prompt the user for "yes/no" questions. Add a common helper to simplify the various implementations. Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
2013-07-01ubinize: fix usage textMike Frysinger
Drop duplicate "and the", and tweak grammar slightly. Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
2013-01-15ubiformat: fix error pathWolfram Sang
A few error paths were closing the device, although it was not opened yet. Signed-off-by: Wolfram Sang <w.sang@pengutronix.de> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
2013-01-15ubiformat: clean up synopsis of command-line parametersWolfram Sang
Add -Q and --image-seq, remove double -v Signed-off-by: Wolfram Sang <w.sang@pengutronix.de> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
2012-11-12ubiformat: really skip some messages when quietWolfram Sang
Both logic (only print when not quiet) and the indentation suggest that the braces around the block have been forgotten. Signed-off-by: Wolfram Sang <w.sang@pengutronix.de> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
2012-09-25ubiformat: fix failure on big partitions (>4Gio)Richard Genoud
The offset (which is 64bits when mtd-utils are not compile with WITHOUT_LARGEFILE) is calculated like that: offset = nb * size; But nb and size are int, so on 32bits platforms, there's a possible overflow. So, it should be replace with: offset = (off_t)nb * size; If WITHOUT_LARGEFILE is defined, there still be an overflow, but it's what we want, right ? Cheney Chen tested an ubiformat on a NAND (5.9 GiB mtd part). Reported-by: Cheney Chen <cheneychencl2012@gmail.com> Tested-by: Cheney Chen <cheneychencl2012@gmail.com> Signed-off-by: Richard Genoud <richard.genoud@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
2012-09-03ubirmvol: correct missing space on usageRichard Genoud
Signed-off-by: Richard Genoud <richard.genoud@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
2012-08-23ubiattach: fail if kernel ignores max_beb_per1024Richard Genoud
If the kernel doesn't know the max_beb_per1024 parameter in the attach ioctl, but the call still succeeded ubi_attach and ubi_attach_mtd will return 1 instead of 0. In this case, the ubiattach command will detach the device and fail with an error message. Signed-off-by: Richard Genoud <richard.genoud@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
2012-08-23ubiattach: introduce max_beb_per1024 in UBI_IOCATTRichard Genoud
The ioctl UBI_IOCATT has been extended with max_beb_per1024 parameter. This parameter is used for adjusting the "maximum expected number of bad blocks per 1024 blocks" for each mtd device. The number of physical erase blocks (PEB) that UBI will reserve for bad block handling is now: whole_flash_chipset__PEB_number * max_beb_per1024 / 1024 This means that for a 4096 PEB NAND device with 3 MTD partitions: mtd0: 512 PEB mtd1: 1536 PEB mtd2: 2048 PEB the commands: ubiattach -m 0 -d 0 -b 20 /dev/ubi_ctrl ubiattach -m 1 -d 1 -b 20 /dev/ubi_ctrl ubiattach -m 2 -d 2 -b 20 /dev/ubi_ctrl will attach mtdx to UBIx and reserve: 80 PEB for bad block handling on UBI0 80 PEB for bad block handling on UBI1 80 PEB for bad block handling on UBI2 => for the whole device, 240 PEB will be reserved for bad block handling. This may seems a waste of space, but as far as the bad blocks can appear every where on a flash device, in the worst case scenario they can all appear in one MTD partition. So the maximum number of expected erase blocks given by the NAND manufacturer should be reserve on each MTD partition. Signed-off-by: Richard Genoud <richard.genoud@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
2012-08-23libubi: kill ubi_attach_mtdArtem Bityutskiy
The 'ubi_attach_mtd()' is not used and it is redundant now. 'ubi_attach()' function may be used instead. Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
2012-08-23libubi: factorize ubi_attach and ubi_attach_mtd codeRichard Genoud
The req->mtd_num value is now updated with the MTD device number found by mtd_node_to_num. Signed-off-by: Richard Genoud <richard.genoud@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
2012-08-22UBI: sync ubi-user.h with kernel v3.6-rc1Richard Genoud
Also remove the eraseblock type support, because kernel commit a65a0eb6d198e058687a9214683bd1c418f20d39 set the dtype parameter as obsolete. Also adjust to some renames: * 'UBI_PROP_DIRECT_WRITE' -> 'UBI_VOL_PROP_DIRECT_WRITE' * 'struct ubi_set_prop_req' -> 'struct ubi_set_vol_prop_req'. * 'UBI_IOCSETPROP' -> 'UBI_IOCSETVOLPROP' Signed-off-by: Richard Genoud <richard.genoud@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
2012-02-14mtdinfo: correct grammar on error messageBrian Norris
Signed-off-by: Brian Norris <computersforpeace@gmail.com> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
2012-02-02mtdinfo: fix `--all' for non-consecutive device numbersBrian Norris
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> Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>