Audio: RTNR stub: Avoid error in rtnr_init() with null pointer

The init code checks for NULL and errors, so need to return
from RTKMA_API_Context_Create() a valid allocated address. The
free is added to RTKMA_API_Context_Free().

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
This commit is contained in:
Seppo Ingalsuo 2023-11-02 16:55:59 +02:00 committed by Liam Girdwood
parent ac900459b3
commit 491b29f7bb
1 changed files with 8 additions and 2 deletions

View File

@ -6,6 +6,7 @@
//
#include <sof/audio/rtnr/rtklib/include/RTK_MA_API.h>
#include <rtos/alloc.h>
void RTKMA_API_S16_Default(void *Context, struct audio_stream_rtnr **sources,
struct audio_stream_rtnr *sink, int frames,
@ -36,11 +37,16 @@ void RTKMA_API_Prepare(void *Context)
void *RTKMA_API_Context_Create(int sample_rate)
{
return NULL;
/* Allocate something, to avoid return NULL and cause error
* in check of success of this.
*/
return rzalloc(SOF_MEM_ZONE_RUNTIME, 0, SOF_MEM_CAPS_RAM, 42);
}
void RTKMA_API_Context_Free(void *Context)
{}
{
rfree(Context);
}
int RTKMA_API_Parameter_Size(void *Context, unsigned int IDs)
{