Skip to contentSkip to conversation

mtd: core: set cdev offset

RFC In review Ladislav Michl 1 participant 2 messages Oct 11, 2018 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

RFC 1/1 mtd: core: set cdev offset

Recently added check for overlapping environment always succeeds [*] for mtd partitions not starting at the beginning of flash as cdev.offset is not set. Here's a proposed fix, however someone familiar with codebase should verify/correct this oneliner.

Thank you.

[*] Environment partition (0x00000000-0x000020ff) overlaps with partition dataflash0.at91bootstrap (0x00000000-0x000041ff), not using it

    where "Environment partition" actually starts at 0x4200.
---
 drivers/mtd/core.c | 1 +
 1 file changed, 1 insertion(+)
drivers/mtd/core.c +1 -0
index 58b20cbc2..b40a3303c 100644
@@ -640,6 +640,7 @@ int add_mtd_device(struct mtd_info *mtd, const char *devname, int device_id)
 
 	mtd->cdev.ops = &mtd_ops;
 	mtd->cdev.size = mtd->size;
+	mtd->cdev.offset = mtd->master_offset;
 	if (device_id == DEVICE_ID_SINGLE)
 		mtd->cdev.name = xstrdup(devname);
 	else
Signature · 7 lines
2.19.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#1 lore raw
Quoted 4 lines · Ladislav Michl

Recently added check for overlapping environment always succeeds [*] for mtd partitions not starting at the beginning of flash as cdev.offset is not set. Here's a proposed fix, however someone familiar with codebase should verify/correct this oneliner.

Well, that's not the right way fixing it as other fs operations (protect etc.) are using offset from beginning of the partition...

Quoted 23 lines

Thank you.

[*] Environment partition (0x00000000-0x000020ff) overlaps with partition dataflash0.at91bootstrap (0x00000000-0x000041ff), not using it

    where "Environment partition" actually starts at 0x4200.
---
 drivers/mtd/core.c | 1 +
 1 file changed, 1 insertion(+)
drivers/mtd/core.c +1 -0
index 58b20cbc2..b40a3303c 100644
@@ -640,6 +640,7 @@ int add_mtd_device(struct mtd_info *mtd, const char *devname, int device_id)
 
 	mtd->cdev.ops = &mtd_ops;
 	mtd->cdev.size = mtd->size;
+	mtd->cdev.offset = mtd->master_offset;
 	if (device_id == DEVICE_ID_SINGLE)
 		mtd->cdev.name = xstrdup(devname);
 	else
Signature · 1 line
2.19.1

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox