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:
parent
379f246625
commit
95cf3b3aa9
3 changed files with 18 additions and 18 deletions
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue