memset(info, '\0', sizeof(struct ubi_info));
- if (read_major(lib->ctrl_dev, &info->ctrl_major, &info->ctrl_minor))
- return -1;
+ if (read_major(lib->ctrl_dev, &info->ctrl_major, &info->ctrl_minor)) {
+ /*
+ * Older UBI versions did not have control device, so we do not
+ * panic here for compatibility reasons. May be few years later
+ * we could return -1 here, but for now just set major:minor to
+ * -1.
+ */
+ info->ctrl_major = info->ctrl_minor = -1;
+ }
/*
* We have to scan the UBI sysfs directory to identify how many UBI
printf("UBI version: %d\n", ubi_info.version);
printf("Count of UBI devices: %d\n", ubi_info.dev_count);
- printf("UBI control device major/minor: %d:%d\n",
- ubi_info.ctrl_major, ubi_info.ctrl_minor);
+ if (ubi_info.ctrl_major != -1)
+ printf("UBI control device major/minor: %d:%d\n",
+ ubi_info.ctrl_major, ubi_info.ctrl_minor);
+ else
+ printf("UBI control device is not supported by this kernel\n");
if (ubi_info.dev_count == 0)
return 0;