diff --git a/model/storage/src/mmc/mmc_block.c b/model/storage/src/mmc/mmc_block.c index 86ba1c7424dbc66969e4904790765bd52ff40db6..19a0949ab5e0c9e96d65639caf228391fec7c652 100644 --- a/model/storage/src/mmc/mmc_block.c +++ b/model/storage/src/mmc/mmc_block.c @@ -11,7 +11,6 @@ #include "hdf_base.h" #include "hdf_log.h" #include "mmc_block.h" -#include "platform_core.h" #define HDF_LOG_TAG mmc_block_c diff --git a/model/storage/src/mtd/mtd_core.c b/model/storage/src/mtd/mtd_core.c index 5093da2ced372b9ae38268f10732aab4b5ff0be1..65e33a1c458b7a53ed27584a65b0e5e2b915027b 100644 --- a/model/storage/src/mtd/mtd_core.c +++ b/model/storage/src/mtd/mtd_core.c @@ -208,8 +208,8 @@ static void MtdDumpBuf(uint8_t *buf, size_t len) #define MTD_DUMP_BUF_LEN (MTD_DUMP_LINE_LEN * MTD_DUMP_SIGLE_WIDTH + 1) char lineBuf[MTD_DUMP_BUF_LEN]; - for (idx = 0; idx < len; ) { - line = (MTD_DUMP_LINE_LEN <= (len - idx)) ? MTD_DUMP_LINE_LEN : len - idx; + for (idx = 0; idx < len;) { + line = (MTD_DUMP_LINE_LEN <= (len - idx)) ? MTD_DUMP_LINE_LEN : (len - idx); for (i = 0, lidx = 0; i < line; i++, lidx += MTD_DUMP_SIGLE_WIDTH, buf++) { ret = snprintf_s(lineBuf + lidx, MTD_DUMP_SIGLE_WIDTH + 1, MTD_DUMP_SIGLE_WIDTH, "%02x", *buf); if (ret < 0) { @@ -388,7 +388,7 @@ static int32_t MtdDeviceWriteReadByPageUnlock(struct MtdDevice *mtdDevice, struc dataLenLeft = msg->withOob ? (msg->len / (mtdDevice->writeSize + mtdDevice->oobSize)) * mtdDevice->writeSize : msg->len; - for (addr = msg->addr, buf = msg->buf; (dataLenLeft > 0) && addr < mtdDevice->capacity; ) { + for (addr = msg->addr, buf = msg->buf; (dataLenLeft > 0) && addr < mtdDevice->capacity;) { if (MtdDeviceIsBadBlockUnlocked(mtdDevice, addr)) { if (!msg->skipBad) { HDF_LOGE("%s: failed on bad block @0x%jx", __func__, addr); @@ -399,7 +399,7 @@ static int32_t MtdDeviceWriteReadByPageUnlock(struct MtdDevice *mtdDevice, struc continue; } eraseOffset = addr & (mtdDevice->eraseSize - 1); - blockSize = dataLenLeft < (mtdDevice->eraseSize - eraseOffset) ? + blockSize = (dataLenLeft < (mtdDevice->eraseSize - eraseOffset)) ? dataLenLeft : (mtdDevice->eraseSize - eraseOffset); // no more than one block at once mtdPage.type = msg->type; @@ -410,7 +410,7 @@ static int32_t MtdDeviceWriteReadByPageUnlock(struct MtdDevice *mtdDevice, struc if (mtdPage.dataLen > blockSize) { mtdPage.dataLen = blockSize; } - mtdPage.oobBuf = msg->withOob ? buf + mtdPage.dataLen : NULL; + mtdPage.oobBuf = msg->withOob ? (buf + mtdPage.dataLen) : NULL; mtdPage.oobLen = msg->withOob ? mtdDevice->oobSize : 0; ret = MtdDevicePageTransferUnlocked(mtdDevice, &mtdPage); if (ret != HDF_SUCCESS) {