forked from nuttx/nuttx-update
drivers/can: enter_critical_section in can_poll
This commit is contained in:
parent
247bc10c26
commit
908ee31e7d
1 changed files with 7 additions and 1 deletions
|
@ -1024,6 +1024,7 @@ static int can_poll(FAR struct file *filep, FAR struct pollfd *fds,
|
|||
FAR struct can_reader_s *reader = NULL;
|
||||
pollevent_t eventset;
|
||||
int ndx;
|
||||
irqstate_t flags;
|
||||
int ret;
|
||||
int i;
|
||||
|
||||
|
@ -1036,6 +1037,8 @@ static int can_poll(FAR struct file *filep, FAR struct pollfd *fds,
|
|||
}
|
||||
#endif
|
||||
|
||||
flags = enter_critical_section();
|
||||
|
||||
DEBUGASSERT(filep->f_priv != NULL);
|
||||
reader = (FAR struct can_reader_s *)filep->f_priv;
|
||||
|
||||
|
@ -1048,7 +1051,7 @@ static int can_poll(FAR struct file *filep, FAR struct pollfd *fds,
|
|||
* will abort the operation
|
||||
*/
|
||||
|
||||
return ret;
|
||||
goto return_with_irqdisabled;
|
||||
}
|
||||
|
||||
/* Are we setting up the poll? Or tearing it down? */
|
||||
|
@ -1162,6 +1165,9 @@ static int can_poll(FAR struct file *filep, FAR struct pollfd *fds,
|
|||
|
||||
errout:
|
||||
can_givesem(&dev->cd_pollsem);
|
||||
|
||||
return_with_irqdisabled:
|
||||
leave_critical_section(flags);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue