You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2021/04/07 08:35:59 UTC
[GitHub] [incubator-nuttx] fjpanag commented on a change in pull request #3454: syslog: Proper uninit of syslog_device.
fjpanag commented on a change in pull request #3454:
URL: https://github.com/apache/incubator-nuttx/pull/3454#discussion_r608453024
##########
File path: drivers/syslog/syslog_device.c
##########
@@ -435,22 +435,44 @@ void syslog_dev_uninitialize(FAR struct syslog_channel_s *channel)
{
FAR struct syslog_dev_s *syslog_dev = (FAR struct syslog_dev_s *)channel;
- /* Check if the system is ready */
+ /* Uninitializing a SYSLOG device should not take place within
+ * interrupt context.
+ */
- if (syslog_dev_outputready(syslog_dev) < 0)
+ if (up_interrupt_context() || getpid() == 0)
{
+ DEBUGASSERT(!up_interrupt_context() && getpid() != 0);
return;
}
- /* Attempt to flush any buffered data */
+ /* The device cannot be unititialized while it is being
+ * initialized simultaneously.
+ */
+
+ DEBUGASSERT(syslog_dev->sl_state != SYSLOG_UNINITIALIZED &&
+ syslog_dev->sl_state != SYSLOG_INITIALIZING);
+
+ /* Attempt to flush any buffered data. */
sched_lock();
syslog_dev_flush(channel);
- /* Close the detached file instance */
+ /* Close the detached file instance, and destroy the
+ * semaphore. These are both only created when the
+ * device is in SYSLOG_OPENED or SYSLOG_FAILURE
+ * state.
+ */
Review comment:
Done.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org