Skip to content

Instantly share code, notes, and snippets.

@zavorka
Created July 5, 2017 14:40
Show Gist options
  • Save zavorka/06900adf21fb0e96b3f0786e926c4d3b to your computer and use it in GitHub Desktop.
Save zavorka/06900adf21fb0e96b3f0786e926c4d3b to your computer and use it in GitHub Desktop.
Ambarella fucking things up again.
diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c
index 03331c173bd0..f93f0e54b904 100644
--- a/drivers/mtd/ubi/build.c
+++ b/drivers/mtd/ubi/build.c
@@ -905,15 +905,34 @@ int ubi_attach_mtd_dev(struct mtd_info *mtd, int ubi_num,
if (ubi_num == UBI_DEV_NUM_AUTO) {
/* Search for an empty slot in the @ubi_devices array */
- for (ubi_num = 0; ubi_num < UBI_MAX_DEVICES; ubi_num++)
- if (!ubi_devices[ubi_num])
+ for (ubi_num = 0; ubi_num < UBI_MAX_DEVICES; ubi_num++) {
+ /*
+ * Angee patch: Skip ubi_num 2 to avoid device numbers
+ * clashing with the Ambarella's major 248
+ */
+ if (ubi_num == 2) {
+ continue;
+ }
+ if (!ubi_devices[ubi_num]) {
break;
+ }
+ }
if (ubi_num == UBI_MAX_DEVICES) {
ubi_err("only %d UBI devices may be created",
UBI_MAX_DEVICES);
return -ENFILE;
}
} else {
+ if (ubi_num == 2) {
+ /*
+ * Angee patch: Avoid ubi device numbers
+ * clashing with the Ambarella video devices
+ */
+ ubi_err("major 248 belongs to Ambarella, "
+ "let em keep it pls");
+ return -EINVAL; // or EEXIST? Dunno, help pls.
+ }
+
if (ubi_num >= UBI_MAX_DEVICES)
return -EINVAL;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment