ipc: fix ipc_msg_init call to use preinitialized structure fields

ipc_msg_init should use the already initialized size field in
rhdr structure instead using the sizeof.

Signed-off-by: Rafal Redzimski <rafal.f.redzimski@intel.com>
This commit is contained in:
Rafal Redzimski 2022-04-22 15:05:26 +02:00 committed by Liam Girdwood
parent 70dc03dc65
commit c5a5bf1793
3 changed files with 3 additions and 3 deletions

View File

@ -116,7 +116,7 @@ static struct comp_dev *ghd_create(const struct comp_driver *drv,
cd->event.event_type = SOF_CTRL_EVENT_KD;
cd->event.num_elems = 0;
cd->msg = ipc_msg_init(cd->event.rhdr.hdr.cmd, sizeof(cd->event));
cd->msg = ipc_msg_init(cd->event.rhdr.hdr.cmd, cd->event.rhdr.size);
if (!cd->msg) {
comp_err(dev, "ghd_create(): ipc_msg_init failed");
goto cd_fail;

View File

@ -659,7 +659,7 @@ static struct comp_dev *host_new(const struct comp_driver *drv,
ipc_build_stream_posn(&hd->posn, SOF_IPC_STREAM_POSITION, dev->ipc_config.id);
hd->msg = ipc_msg_init(hd->posn.rhdr.hdr.cmd, sizeof(hd->posn));
hd->msg = ipc_msg_init(hd->posn.rhdr.hdr.cmd, hd->posn.rhdr.hdr.size);
if (!hd->msg) {
comp_err(dev, "host_new(): ipc_msg_init failed");
dma_put(hd->dma);

View File

@ -146,7 +146,7 @@ struct pipeline *pipeline_new(uint32_t pipeline_id, uint32_t priority, uint32_t
/* just for retrieving valid ipc_msg header */
ipc_build_stream_posn(&posn, SOF_IPC_STREAM_TRIG_XRUN, p->comp_id);
p->msg = ipc_msg_init(posn.rhdr.hdr.cmd, sizeof(posn));
p->msg = ipc_msg_init(posn.rhdr.hdr.cmd, posn.rhdr.hdr.size);
if (!p->msg) {
pipe_err(p, "pipeline_new(): ipc_msg_init failed");
rfree(p);