libc/mtdoutstream: Replace stream->geo.erasesize with erasesize

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao
2024-08-19 01:34:27 +08:00
committed by archer
parent fa57289d68
commit 1e343a884b
+3 -4
View File
@@ -102,10 +102,9 @@ static int mtdoutstream_puts(FAR struct lib_outstream_s *self,
#ifdef CONFIG_MTD_BYTE_WRITE
if (stream->inode->u.i_mtd->write != NULL)
{
if (self->nput % stream->geo.erasesize == 0)
if (self->nput % erasesize == 0)
{
ret = MTD_ERASE(inode->u.i_mtd,
self->nput / stream->geo.erasesize, 1);
ret = MTD_ERASE(inode->u.i_mtd, self->nput / erasesize, 1);
if (ret < 0)
{
return ret;
@@ -162,7 +161,7 @@ static int mtdoutstream_puts(FAR struct lib_outstream_s *self,
* so no random content will be flushed
*/
memset(stream->cache, 0, stream->geo.erasesize);
memset(stream->cache, 0, erasesize);
memcpy(stream->cache, ptr, remain);
self->nput += remain;
remain = 0;