aboutsummaryrefslogtreecommitdiff
path: root/ubi-utils/ubiattach.c
diff options
context:
space:
mode:
authorRichard Genoud <richard.genoud@gmail.com>2012-08-22 18:04:37 +0200
committerArtem Bityutskiy <artem.bityutskiy@linux.intel.com>2012-08-23 12:48:54 +0300
commit9d8751b3f5c6358b6167c38899f1e41498d24a45 (patch)
treedb952e5015e6f33a2e93e3cf477227ea5d52dfc9 /ubi-utils/ubiattach.c
parent878e06ea555ba5dbfb974b3904d1a86a9a0e20f5 (diff)
ubiattach: fail if kernel ignores max_beb_per1024
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>
Diffstat (limited to 'ubi-utils/ubiattach.c')
-rw-r--r--ubi-utils/ubiattach.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/ubi-utils/ubiattach.c b/ubi-utils/ubiattach.c
index 8dd0bf6..a7c62d0 100644
--- a/ubi-utils/ubiattach.c
+++ b/ubi-utils/ubiattach.c
@@ -216,12 +216,18 @@ int main(int argc, char * const argv[])
req.max_beb_per1024 = args.max_beb_per1024;
err = ubi_attach(libubi, args.node, &req);
- if (err) {
+ if (err < 0) {
if (args.dev)
sys_errmsg("cannot attach \"%s\"", args.dev);
else
sys_errmsg("cannot attach mtd%d", args.mtdn);
goto out_libubi;
+ } else if (err == 1) {
+ /* The kernel did not support the 'max_beb_per1024' parameter */
+ warnmsg("the --max-beb-per1024=%d parameter was ignored", args.max_beb_per1024);
+ normsg("the UBI kernel driver does not support does not allow changing the reserved PEBs count");
+ normsg("the support was added in kernel version 3.7, probably you are running older kernel?");
+ goto out_libubi;
}
/* Print some information about the new UBI device */