mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
Merge pull request #17913 from benpicco/mtd_fixes
mtd: minor cleanup & test fixes
This commit is contained in:
commit
e3f9252947
@ -201,7 +201,7 @@ int mtd_write_page(mtd_dev_t *mtd, const void *data, uint32_t page,
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
if (mtd->work_area == NULL) {
|
||||
if (mtd->driver->flags & MTD_DRIVER_FLAG_DIRECT_WRITE) {
|
||||
return mtd_write_page_raw(mtd, data, page, offset, len);
|
||||
}
|
||||
|
||||
|
@ -107,14 +107,14 @@ static int cmd_read(int argc, char **argv)
|
||||
|
||||
int res = mtd_read(dev, buffer, addr, len);
|
||||
|
||||
od_hex_dump_ext(buffer, len, 0, addr);
|
||||
|
||||
free(buffer);
|
||||
|
||||
if (res) {
|
||||
printf("error: %i\n", res);
|
||||
} else {
|
||||
od_hex_dump_ext(buffer, len, 0, addr);
|
||||
}
|
||||
|
||||
free(buffer);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
@ -140,14 +140,14 @@ static int cmd_read_page(int argc, char **argv)
|
||||
|
||||
int res = mtd_read_page(dev, buffer, page, offset, len);
|
||||
|
||||
od_hex_dump_ext(buffer, len, 0, page * dev->page_size + offset);
|
||||
|
||||
free(buffer);
|
||||
|
||||
if (res) {
|
||||
printf("error: %i\n", res);
|
||||
} else {
|
||||
od_hex_dump_ext(buffer, len, 0, page * dev->page_size + offset);
|
||||
}
|
||||
|
||||
free(buffer);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user