* [RFC] mtd: core: set cdev offset
@ 2018-10-11 16:42 Ladislav Michl
2018-10-11 23:37 ` Ladislav Michl
0 siblings, 1 reply; 2+ messages in thread
From: Ladislav Michl @ 2018-10-11 16:42 UTC (permalink / raw)
To: barebox
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(+)
diff --git a/drivers/mtd/core.c b/drivers/mtd/core.c
index 58b20cbc2..b40a3303c 100644
--- a/drivers/mtd/core.c
+++ b/drivers/mtd/core.c
@@ -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
--
2.19.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [RFC] mtd: core: set cdev offset
2018-10-11 16:42 [RFC] mtd: core: set cdev offset Ladislav Michl
@ 2018-10-11 23:37 ` Ladislav Michl
0 siblings, 0 replies; 2+ messages in thread
From: Ladislav Michl @ 2018-10-11 23:37 UTC (permalink / raw)
To: barebox
On Thu, Oct 11, 2018 at 06:42:16PM +0200, Ladislav Michl wrote:
> 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...
> 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(+)
>
> diff --git a/drivers/mtd/core.c b/drivers/mtd/core.c
> index 58b20cbc2..b40a3303c 100644
> --- a/drivers/mtd/core.c
> +++ b/drivers/mtd/core.c
> @@ -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
> --
> 2.19.1
>
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-10-11 23:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-11 16:42 [RFC] mtd: core: set cdev offset Ladislav Michl
2018-10-11 23:37 ` Ladislav Michl
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox