mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
drivers/mtd: move write_size assertion after init call
This commit is contained in:
parent
bbf0b3aeb7
commit
477a86022f
@ -36,6 +36,10 @@ int mtd_init(mtd_dev_t *mtd)
|
||||
|
||||
int res = -ENOTSUP;
|
||||
|
||||
if (mtd->driver->init) {
|
||||
res = mtd->driver->init(mtd);
|
||||
}
|
||||
|
||||
/* Drivers preceding the introduction of write_size need to set it. While
|
||||
* this assert breaks applications that previously worked, it is likely
|
||||
* that these applications silently assumed a certain write size and would
|
||||
@ -45,10 +49,6 @@ int mtd_init(mtd_dev_t *mtd)
|
||||
* writes. */
|
||||
assert(mtd->write_size != 0);
|
||||
|
||||
if (mtd->driver->init) {
|
||||
res = mtd->driver->init(mtd);
|
||||
}
|
||||
|
||||
#ifdef MODULE_MTD_WRITE_PAGE
|
||||
if ((mtd->driver->flags & MTD_DRIVER_FLAG_DIRECT_WRITE) == 0) {
|
||||
mtd->work_area = malloc(mtd->pages_per_sector * mtd->page_size);
|
||||
|
Loading…
Reference in New Issue
Block a user