masayuki2009 commented on a change in pull request #2282:
URL: https://github.com/apache/incubator-nuttx/pull/2282#discussion_r525015043
##########
File path: drivers/audio/cxd56.c
##########
@@ -3269,27 +3415,38 @@ static int cxd56_enqueuebuffer(FAR struct
audio_lowerhalf_s *lower,
FAR struct cxd56_dev_s *priv = (FAR struct cxd56_dev_s *)lower;
struct audio_msg_s msg;
irqstate_t flags;
+ int ret;
flags = spin_lock_irqsave();
- apb->dq_entry.flink = NULL;
- dq_put(&priv->up_pendq, &apb->dq_entry);
-
- spin_unlock_irqrestore(flags);
-
- if (priv->mq != NULL)
+#ifdef CONFIG_AUDIO_CXD56_SRC
+ ret = cxd56_src_enqueue(apb);
+ if (ret != OK)
{
- int ret;
+ auderr("ERROR: SRC processing failed (%d)\n", ret);
+ }
+ else
+ {
+#endif
+ apb->dq_entry.flink = NULL;
+ dq_put(&priv->up_pendq, &apb->dq_entry);
- msg.msg_id = AUDIO_MSG_ENQUEUE;
- msg.u.data = 0;
+ spin_unlock_irqrestore(flags);
- ret = nxmq_send(priv->mq, (FAR const char *) &msg,
- sizeof(msg), CONFIG_CXD56_MSG_PRIO);
- if (ret != OK)
+ if (priv->mq != NULL)
{
- auderr("ERROR: nxmq_send to enqueue failed (%d)\n", ret);
- return ret;
+ msg.msg_id = AUDIO_MSG_ENQUEUE;
+ msg.u.data = 0;
+
+ ret = nxmq_send(priv->mq, (FAR const char *) &msg,
+ sizeof(msg), CONFIG_CXD56_MSG_PRIO);
+ if (ret != OK)
+ {
+ auderr("ERROR: nxmq_send to enqueue failed (%d)\n", ret);
+ return ret;
+#ifdef CONFIG_AUDIO_CXD56_SRC
Review comment:
@jerpelea
I think this ```ifdef CONFIG_AUDIO_CXD56_SRC``` is miplaced.
##########
File path: drivers/audio/cxd56.c
##########
@@ -3269,27 +3415,38 @@ static int cxd56_enqueuebuffer(FAR struct
audio_lowerhalf_s *lower,
FAR struct cxd56_dev_s *priv = (FAR struct cxd56_dev_s *)lower;
struct audio_msg_s msg;
irqstate_t flags;
+ int ret;
flags = spin_lock_irqsave();
Review comment:
@jerpelea
I think this ```flag = spin_lock_irqsave();``` should be moved to inside the
else condition.
Otherwise, a deadlock would happen if ```cxd56_src_enqueue()``` returns an
error.
----------------------------------------------------------------
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:
[email protected]