mirror of
https://github.com/apache/nuttx.git
synced 2026-05-26 10:46:28 +08:00
drivers/can: enter_critical_section in can_poll
This commit is contained in:
committed by
Alan Carvalho de Assis
parent
247bc10c26
commit
908ee31e7d
+7
-1
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user