kernel: bump 5.10 to 5.10.163
[openwrt/openwrt.git] / target / linux / generic / hack-5.10 / 421-mtd-fix-squashfs-root-on-targets-with-CONFIG_FIT_PAR.patch
1 From: Felix Fietkau <nbd@nbd.name>
2 Date: Sat Apr 10 17:00:57 2021 +0200
3 Subject: [PATCH] mtd: fix squashfs root on targets with CONFIG_FIT_PARTITION
4
5 Fix assumption about the block device index
6 ---
7
8 --- a/drivers/mtd/mtdcore.c
9 +++ b/drivers/mtd/mtdcore.c
10 @@ -760,12 +760,18 @@ int add_mtd_device(struct mtd_info *mtd)
11
12 if (of_find_property(mtd_get_of_node(mtd), "linux,rootfs", NULL) ||
13 (IS_ENABLED(CONFIG_MTD_ROOTFS_ROOT_DEV) && !strcmp(mtd->name, "rootfs") && ROOT_DEV == 0)) {
14 + unsigned int index = mtd->index;
15 +
16 +#ifdef CONFIG_FIT_PARTITION
17 + index <<= 2;
18 +#endif
19 +
20 if (IS_BUILTIN(CONFIG_MTD)) {
21 - pr_info("mtd: setting mtd%d (%s) as root device\n", mtd->index, mtd->name);
22 - ROOT_DEV = MKDEV(MTD_BLOCK_MAJOR, mtd->index);
23 + pr_info("mtd: setting mtd%d (%s) as root device\n", index, mtd->name);
24 + ROOT_DEV = MKDEV(MTD_BLOCK_MAJOR, index);
25 } else {
26 pr_warn("mtd: can't set mtd%d (%s) as root device - mtd must be builtin\n",
27 - mtd->index, mtd->name);
28 + index, mtd->name);
29 }
30 }
31