anchao commented on code in PR #15958:
URL: https://github.com/apache/nuttx/pull/15958#discussion_r1986569809


##########
audio/audio_comp.c:
##########
@@ -942,31 +942,27 @@ FAR struct audio_lowerhalf_s *audio_comp_initialize(FAR 
const char *name,
 {
   FAR struct audio_comp_priv_s *priv;
   va_list ap;
-  int ret = -ENOMEM;
-  int i;
-
-  priv = kmm_zalloc(sizeof(struct audio_comp_priv_s));
-  if (priv == NULL)
-    {
-      return NULL;
-    }
-
-  priv->export.ops = &g_audio_comp_ops;
+  int ret;
+  int i = 0;
 
   va_start(ap, name);
-  while (va_arg(ap, FAR struct audio_lowerhalf_s *))
+  while (va_arg(ap, FAR void *))
     {
-      priv->count++;
+      i++;
     }
 
   va_end(ap);
-  priv->lower = kmm_calloc(priv->count,
-                           sizeof(FAR struct audio_lowerhalf_s *));
-  if (priv->lower == NULL)
+
+  priv = kmm_zalloc(sizeof(struct audio_comp_priv_s) +
+                    sizeof(FAR void *) * i);

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.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to