Merge pull request #368 from Eric-hust/master

[HUST CSE]Modify the null pointer fifo to access first and then judge
This commit is contained in:
Supowang 2023-04-23 15:31:54 +08:00 committed by GitHub
commit 250ca3ef08
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -98,10 +98,10 @@ unsigned int salof_fifo_read(salof_fifo_t fifo, void *buff, unsigned int len, un
{
int l;
salof_sem_pend(fifo->sem, timeout);
if((!fifo) || (!buff) || (!len))
return 0;
salof_sem_pend(fifo->sem, timeout);
len = FIFO_MIN(len, fifo->in - fifo->out);