mm/iob: iob members are initialized after allocate

Signed-off-by: chao an <anchao@xiaomi.com>
This commit is contained in:
chao an
2022-12-15 22:51:14 +08:00
committed by Xiang Xiao
parent 0c21bc4e53
commit 01eb4d586b
8 changed files with 7 additions and 87 deletions
+1 -15
View File
@@ -183,10 +183,6 @@ static void syslogstream_putc(FAR struct lib_outstream_s *this, int ch)
void lib_syslogstream_open(FAR struct lib_syslogstream_s *stream)
{
#ifdef CONFIG_SYSLOG_BUFFER
FAR struct iob_s *iob;
#endif
DEBUGASSERT(stream != NULL);
/* Initialize the common fields */
@@ -198,17 +194,7 @@ void lib_syslogstream_open(FAR struct lib_syslogstream_s *stream)
#ifdef CONFIG_SYSLOG_BUFFER
/* Allocate an IOB */
iob = iob_tryalloc(true);
stream->iob = iob;
if (iob != NULL)
{
/* Initialize the IOB */
iob->io_len = 0;
iob->io_offset = 0;
iob->io_pktlen = 0;
}
stream->iob = iob_tryalloc(true);
#endif
}