Skip to content

Commit c45d5d9

Browse files
rfvirgilbroonie
authored andcommitted
firmware: cs_dsp: Use kvzalloc() to allocate control caches
Use kvzalloc() instead of kzalloc() to allocate memory to cache the content of a firmware control. Most firmware controls are only small, typically a few bytes. But on some firmware there can be much larger controls for coefficient or model data. The overhead of kvzalloc() is negligible because most control allocs can be satisfied by the normal kmalloc() that kvzalloc() will try first. Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com> Link: https://patch.msgid.link/20251127103947.1094934-1-rf@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent ed6e90c commit c45d5d9

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

drivers/firmware/cirrus/cs_dsp.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -989,7 +989,7 @@ static void cs_dsp_signal_event_controls(struct cs_dsp *dsp,
989989

990990
static void cs_dsp_free_ctl_blk(struct cs_dsp_coeff_ctl *ctl)
991991
{
992-
kfree(ctl->cache);
992+
kvfree(ctl->cache);
993993
kfree(ctl->subname);
994994
kfree(ctl);
995995
}
@@ -1039,7 +1039,7 @@ static int cs_dsp_create_control(struct cs_dsp *dsp,
10391039
ctl->type = type;
10401040
ctl->offset = offset;
10411041
ctl->len = len;
1042-
ctl->cache = kzalloc(ctl->len, GFP_KERNEL);
1042+
ctl->cache = kvzalloc(ctl->len, GFP_KERNEL);
10431043
if (!ctl->cache) {
10441044
ret = -ENOMEM;
10451045
goto err_ctl_subname;
@@ -1057,7 +1057,7 @@ static int cs_dsp_create_control(struct cs_dsp *dsp,
10571057

10581058
err_list_del:
10591059
list_del(&ctl->list);
1060-
kfree(ctl->cache);
1060+
kvfree(ctl->cache);
10611061
err_ctl_subname:
10621062
kfree(ctl->subname);
10631063
err_ctl:

0 commit comments

Comments
 (0)