mirror of https://github.com/thesofproject/sof.git
ipc3: helper: Do not silently accept unrecognized component type in IPC
Return an error code from comp_specific_builder() if the component type is not recognized, instead of just silently ignoring the error. Signed-off-by: Jyri Sarha <jyri.sarha@linux.intel.com>
This commit is contained in:
parent
be2c2fc000
commit
21ed10abf8
|
@ -191,8 +191,8 @@ union ipc_config_specific {
|
||||||
} __attribute__((packed, aligned(4)));
|
} __attribute__((packed, aligned(4)));
|
||||||
|
|
||||||
/* build component specific data */
|
/* build component specific data */
|
||||||
static void comp_specific_builder(struct sof_ipc_comp *comp,
|
static int comp_specific_builder(struct sof_ipc_comp *comp,
|
||||||
union ipc_config_specific *config)
|
union ipc_config_specific *config)
|
||||||
{
|
{
|
||||||
#if CONFIG_LIBRARY
|
#if CONFIG_LIBRARY
|
||||||
struct sof_ipc_comp_file *file = (struct sof_ipc_comp_file *)comp;
|
struct sof_ipc_comp_file *file = (struct sof_ipc_comp_file *)comp;
|
||||||
|
@ -285,8 +285,9 @@ static void comp_specific_builder(struct sof_ipc_comp *comp,
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ipc_comp_dev *ipc_get_comp_by_ppl_id(struct ipc *ipc, uint16_t type, uint32_t ppl_id)
|
struct ipc_comp_dev *ipc_get_comp_by_ppl_id(struct ipc *ipc, uint16_t type, uint32_t ppl_id)
|
||||||
|
@ -328,8 +329,11 @@ struct comp_dev *comp_new(struct sof_ipc_comp *comp)
|
||||||
drv->tctx->uuid_p, comp->type, comp->pipeline_id, comp->id);
|
drv->tctx->uuid_p, comp->type, comp->pipeline_id, comp->id);
|
||||||
|
|
||||||
/* build the component */
|
/* build the component */
|
||||||
|
if (comp_specific_builder(comp, &spec) < 0) {
|
||||||
|
comp_cl_err(drv, "comp_new(): component type not recognized");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
comp_common_builder(comp, &config);
|
comp_common_builder(comp, &config);
|
||||||
comp_specific_builder(comp, &spec);
|
|
||||||
cdev = drv->ops.create(drv, &config, &spec);
|
cdev = drv->ops.create(drv, &config, &spec);
|
||||||
if (!cdev) {
|
if (!cdev) {
|
||||||
comp_cl_err(drv, "comp_new(): unable to create the new component");
|
comp_cl_err(drv, "comp_new(): unable to create the new component");
|
||||||
|
|
Loading…
Reference in New Issue