1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-15 01:23:49 +01:00

cpu/sam0_common/sam0_sdhc: prevent work_area double allocation

This commit is contained in:
Fabian Hüßler 2025-02-12 16:25:31 +01:00
parent 85a09681bc
commit 452f75fa3c

View File

@ -46,9 +46,11 @@ static int _init(mtd_dev_t *dev)
#if IS_USED(MODULE_MTD_WRITE_PAGE)
/* TODO: move to MTD layer */
dev->work_area = malloc(SD_MMC_BLOCK_SIZE);
if (dev->work_area == NULL) {
return -ENOMEM;
if (!dev->work_area) {
dev->work_area = malloc(SD_MMC_BLOCK_SIZE);
if (dev->work_area == NULL) {
return -ENOMEM;
}
}
dev->write_size = 1;
#endif