mirror of
https://github.com/apache/nuttx.git
synced 2026-05-24 07:46:16 +08:00
blk/mtdoutstream: should flush before free
to avoid losing the data in the buffer Signed-off-by: buxiasen <buxiasen@xiaomi.com>
This commit is contained in:
@@ -239,18 +239,18 @@ void lib_blkoutstream_close(FAR struct lib_blkoutstream_s *stream)
|
||||
{
|
||||
if (stream != NULL)
|
||||
{
|
||||
if (stream->inode != NULL)
|
||||
{
|
||||
close_blockdriver(stream->inode);
|
||||
stream->inode = NULL;
|
||||
}
|
||||
|
||||
if (stream->cache != NULL)
|
||||
{
|
||||
blkoutstream_flush(&stream->common);
|
||||
lib_free(stream->cache);
|
||||
stream->cache = NULL;
|
||||
}
|
||||
|
||||
if (stream->inode != NULL)
|
||||
{
|
||||
close_blockdriver(stream->inode);
|
||||
stream->inode = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -267,18 +267,18 @@ void lib_mtdoutstream_close(FAR struct lib_mtdoutstream_s *stream)
|
||||
{
|
||||
if (stream != NULL)
|
||||
{
|
||||
if (stream->inode != NULL)
|
||||
{
|
||||
close_mtddriver(stream->inode);
|
||||
stream->inode = NULL;
|
||||
}
|
||||
|
||||
if (stream->cache != NULL)
|
||||
{
|
||||
mtdoutstream_flush(&stream->common);
|
||||
lib_free(stream->cache);
|
||||
stream->cache = NULL;
|
||||
}
|
||||
|
||||
if (stream->inode != NULL)
|
||||
{
|
||||
close_mtddriver(stream->inode);
|
||||
stream->inode = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -277,18 +277,18 @@ void lib_mtdsostream_close(FAR struct lib_mtdsostream_s *stream)
|
||||
{
|
||||
if (stream != NULL)
|
||||
{
|
||||
if (stream->inode != NULL)
|
||||
{
|
||||
close_mtddriver(stream->inode);
|
||||
stream->inode = NULL;
|
||||
}
|
||||
|
||||
if (stream->cache != NULL)
|
||||
{
|
||||
mtdsostream_flush(&stream->common);
|
||||
lib_free(stream->cache);
|
||||
stream->cache = NULL;
|
||||
}
|
||||
|
||||
if (stream->inode != NULL)
|
||||
{
|
||||
close_mtddriver(stream->inode);
|
||||
stream->inode = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user