summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sound/soc/fsl/fsl_dsp_xaf_api.c23
-rw-r--r--sound/soc/fsl/fsl_dsp_xaf_api.h2
2 files changed, 22 insertions, 3 deletions
diff --git a/sound/soc/fsl/fsl_dsp_xaf_api.c b/sound/soc/fsl/fsl_dsp_xaf_api.c
index f40560b099ad..05d1a1685989 100644
--- a/sound/soc/fsl/fsl_dsp_xaf_api.c
+++ b/sound/soc/fsl/fsl_dsp_xaf_api.c
@@ -233,14 +233,14 @@ int xaf_comp_create(struct xf_client *client, struct xf_proxy *proxy,
ret = xf_load_lib(client, p_handle, &p_comp->codec_wrap_lib);
if (ret) {
dev_err(dsp_priv->dev, "load codec wrap lib error\n");
- return ret;
+ goto err_wrap_load;
}
/* ...load codec lib */
ret = xf_load_lib(client, p_handle, &p_comp->codec_lib);
if (ret) {
dev_err(dsp_priv->dev, "load codec lib error\n");
- return ret;
+ goto err_codec_load;
}
/* ...allocate input buffer */
@@ -248,7 +248,7 @@ int xaf_comp_create(struct xf_client *client, struct xf_proxy *proxy,
XF_POOL_INPUT, &p_comp->inpool);
if (ret) {
dev_err(dsp_priv->dev, "alloc input buf error\n");
- return ret;
+ goto err_pool_alloc;
}
/* ...initialize input buffer pointer */
@@ -256,6 +256,17 @@ int xaf_comp_create(struct xf_client *client, struct xf_proxy *proxy,
p_comp->inptr = xf_buffer_data(buf);
}
+ p_comp->active = true;
+
+ return ret;
+
+err_pool_alloc:
+ xf_unload_lib(client, p_handle, &p_comp->codec_lib);
+err_codec_load:
+ xf_unload_lib(client, p_handle, &p_comp->codec_wrap_lib);
+err_wrap_load:
+ xf_close(client, p_handle);
+
return ret;
}
@@ -266,6 +277,12 @@ int xaf_comp_delete(struct xf_client *client, struct xaf_comp *p_comp)
bool loadlib = true;
u32 ret = 0;
+ if (!p_comp->active)
+ return ret;
+
+ /* mark component as unusable from this point */
+ p_comp->active = false;
+
if (p_comp->comp_type == RENDER_ESAI)
loadlib = false;
diff --git a/sound/soc/fsl/fsl_dsp_xaf_api.h b/sound/soc/fsl/fsl_dsp_xaf_api.h
index 5087b46520d5..d6dc734000aa 100644
--- a/sound/soc/fsl/fsl_dsp_xaf_api.h
+++ b/sound/soc/fsl/fsl_dsp_xaf_api.h
@@ -45,6 +45,8 @@ struct xaf_comp {
struct lib_info codec_lib;
struct lib_info codec_wrap_lib;
+
+ int active; /* component fully initialized */
};
struct xaf_pipeline {