mm/iob: Don't return NULL in iob_pack
We don't want to get a NULL pointer after iob_pack on an IOB chain with several iobs with length 0, it should return one IOB with length 0. Otherwise each place calls iob_pack needs to check the result. Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
This commit is contained in:
parent
1aceb1d872
commit
44a04733d4
@ -51,15 +51,11 @@ FAR struct iob_s *iob_pack(FAR struct iob_s *iob)
|
||||
unsigned int ncopy;
|
||||
unsigned int navail;
|
||||
|
||||
/* Handle special cases */
|
||||
/* Handle special cases, preserve at least one iob. */
|
||||
|
||||
while (iob->io_len <= 0)
|
||||
while (iob->io_len <= 0 && iob->io_flink != NULL)
|
||||
{
|
||||
iob = iob_free(iob);
|
||||
if (iob == NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/* Now remember the head of the chain (for the return value) */
|
||||
|
Loading…
Reference in New Issue
Block a user