You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ac...@apache.org on 2022/04/10 18:41:24 UTC

[incubator-nuttx] 02/02: audio: Don't register audio device if name isn't given in audio_comp_initialize

This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit 1a6ee1b90855a583b5ef11c632d1b5e61af529ab
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Sun Apr 10 03:19:03 2022 +0800

    audio: Don't register audio device if name isn't given in audio_comp_initialize
    
    Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
 audio/audio_comp.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/audio/audio_comp.c b/audio/audio_comp.c
index ad3f929919..5af63994d2 100644
--- a/audio/audio_comp.c
+++ b/audio/audio_comp.c
@@ -969,10 +969,13 @@ FAR struct audio_lowerhalf_s *audio_comp_initialize(FAR const char *name,
     }
 
   va_end(ap);
-  ret = audio_register(name, &priv->export);
-  if (ret < 0)
+  if (name != NULL)
     {
-      goto free_lower;
+      ret = audio_register(name, &priv->export);
+      if (ret < 0)
+        {
+          goto free_lower;
+        }
     }
 
   return &priv->export;