Skip to content

Commit 37f470e

Browse files
author
Jyri Sarha
committed
ASoC: SOF: ipc4-topology: Optimize sof_ipc4_widget_mod_init_msg_payload()
Optimize sof_ipc4_widget_mod_init_msg_payload() so that it skips the payload allocation and rest of the function if no payload is needed. Signed-off-by: Jyri Sarha <jyri.sarha@linux.intel.com>
1 parent bb00e25 commit 37f470e

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

sound/soc/sof/ipc4-topology.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3170,6 +3170,13 @@ static int sof_ipc4_widget_mod_init_msg_payload(struct snd_sof_dev *sdev,
31703170
u32 *payload;
31713171
u32 ext_pos;
31723172

3173+
/*
3174+
* Only DP widgets currently add init-ext objects here. Avoid allocating
3175+
* a max-sized payload buffer for widgets that will immediately return 0.
3176+
*/
3177+
if (swidget->comp_domain != SOF_COMP_DOMAIN_DP)
3178+
return 0;
3179+
31733180
payload = kzalloc(sdev->ipc->max_payload_size, GFP_KERNEL);
31743181
if (!payload)
31753182
return -ENOMEM;

0 commit comments

Comments
 (0)