audio: Return audio_lowerhalf_s pointer instead error code in audio_comp_initialize
This commit is contained in:
parent
dd70d29d4e
commit
f3d20abe07
@ -919,14 +919,15 @@ static void audio_comp_callback(FAR void *arg, uint16_t reason,
|
|||||||
* ... - The list of the lower half audio driver.
|
* ... - The list of the lower half audio driver.
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
* Zero on success; a negated errno value on failure.
|
* struct audio_lowerhalf_s* on success; NULL on failure.
|
||||||
*
|
*
|
||||||
* Note
|
* Note
|
||||||
* The variable argument list must be NULL terminated.
|
* The variable argument list must be NULL terminated.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int audio_comp_initialize(FAR const char *name, ...)
|
FAR struct audio_lowerhalf_s *audio_comp_initialize(FAR const char *name,
|
||||||
|
...)
|
||||||
{
|
{
|
||||||
FAR struct audio_comp_priv_s *priv;
|
FAR struct audio_comp_priv_s *priv;
|
||||||
va_list ap;
|
va_list ap;
|
||||||
@ -936,7 +937,7 @@ int audio_comp_initialize(FAR const char *name, ...)
|
|||||||
priv = kmm_zalloc(sizeof(struct audio_comp_priv_s));
|
priv = kmm_zalloc(sizeof(struct audio_comp_priv_s));
|
||||||
if (priv == NULL)
|
if (priv == NULL)
|
||||||
{
|
{
|
||||||
return ret;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
priv->export.ops = &g_audio_comp_ops;
|
priv->export.ops = &g_audio_comp_ops;
|
||||||
@ -974,11 +975,11 @@ int audio_comp_initialize(FAR const char *name, ...)
|
|||||||
goto free_lower;
|
goto free_lower;
|
||||||
}
|
}
|
||||||
|
|
||||||
return OK;
|
return &priv->export;
|
||||||
|
|
||||||
free_lower:
|
free_lower:
|
||||||
kmm_free(priv->lower);
|
kmm_free(priv->lower);
|
||||||
free_priv:
|
free_priv:
|
||||||
kmm_free(priv);
|
kmm_free(priv);
|
||||||
return ret;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -65,14 +65,15 @@ extern "C"
|
|||||||
* ... - The list of the lower half audio driver.
|
* ... - The list of the lower half audio driver.
|
||||||
*
|
*
|
||||||
* Returned Value:
|
* Returned Value:
|
||||||
* Zero on success; a negated errno value on failure.
|
* struct audio_lowerhalf_s* on success; NULL on failure.
|
||||||
*
|
*
|
||||||
* Note
|
* Note
|
||||||
* The variable argument list must be NULL terminated.
|
* The variable argument list must be NULL terminated.
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
int audio_comp_initialize(FAR const char *name, ...);
|
FAR struct audio_lowerhalf_s *audio_comp_initialize(FAR const char *name,
|
||||||
|
...);
|
||||||
|
|
||||||
#undef EXTERN
|
#undef EXTERN
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
Loading…
Reference in New Issue
Block a user