diskio.c: use the correct error codes

This commit is contained in:
d0k3 2018-07-04 22:51:43 +02:00
parent f74d9ddfd7
commit 5880777e18

View File

@ -171,18 +171,18 @@ DRESULT disk_read (
if (type == TYPE_NONE) { if (type == TYPE_NONE) {
return RES_PARERR; return RES_PARERR;
} else if (type == TYPE_SDCARD) { } else if (type == TYPE_SDCARD) {
if (sdmmc_sdcard_readsectors(sector, count, buff)) if (sdmmc_sdcard_readsectors(sector, count, buff) != 0)
return RES_PARERR; return RES_ERROR;
} else if (type == TYPE_IMAGE) { } else if (type == TYPE_IMAGE) {
if (ReadImageSectors(buff, sector, count)) if (ReadImageSectors(buff, sector, count) != 0)
return RES_PARERR; return RES_ERROR;
} else if (type == TYPE_RAMDRV) { } else if (type == TYPE_RAMDRV) {
if (ReadRamDriveSectors(buff, sector, count)) if (ReadRamDriveSectors(buff, sector, count) != 0)
return RES_PARERR; return RES_ERROR;
} else { } else {
FATpartition* fat_info = PART_INFO(pdrv); FATpartition* fat_info = PART_INFO(pdrv);
if (ReadNandSectors(buff, fat_info->offset + sector, count, fat_info->keyslot, type)) if (ReadNandSectors(buff, fat_info->offset + sector, count, fat_info->keyslot, type) != 0)
return RES_PARERR; return RES_ERROR;
} }
return RES_OK; return RES_OK;
@ -208,18 +208,18 @@ DRESULT disk_write (
if (type == TYPE_NONE) { if (type == TYPE_NONE) {
return RES_PARERR; return RES_PARERR;
} else if (type == TYPE_SDCARD) { } else if (type == TYPE_SDCARD) {
if (sdmmc_sdcard_writesectors(sector, count, (BYTE *)buff)) if (sdmmc_sdcard_writesectors(sector, count, (BYTE *)buff) != 0)
return RES_PARERR; return RES_ERROR;
} else if (type == TYPE_IMAGE) { } else if (type == TYPE_IMAGE) {
if (WriteImageSectors(buff, sector, count)) if (WriteImageSectors(buff, sector, count) != 0)
return RES_PARERR; return RES_ERROR;
} else if (type == TYPE_RAMDRV) { } else if (type == TYPE_RAMDRV) {
if (WriteRamDriveSectors(buff, sector, count)) if (WriteRamDriveSectors(buff, sector, count) != 0)
return RES_PARERR; return RES_ERROR;
} else { } else {
FATpartition* fat_info = PART_INFO(pdrv); FATpartition* fat_info = PART_INFO(pdrv);
if (WriteNandSectors(buff, fat_info->offset + sector, count, fat_info->keyslot, type)) if (WriteNandSectors(buff, fat_info->offset + sector, count, fat_info->keyslot, type) != 0)
return RES_PARERR; // unstubbed! return RES_ERROR; // unstubbed!
} }
return RES_OK; return RES_OK;