firmware: cs_dsp: Use kvzalloc() to allocate control caches
Subsystems (2)
Richard Fitzgerald
maintainerPATCH 1/1 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.
--- drivers/firmware/cirrus/cs_dsp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/firmware/cirrus/cs_dsp.c +3 -3
@@ -987,7 +987,7 @@ static void cs_dsp_signal_event_controls(struct cs_dsp *dsp,static void cs_dsp_free_ctl_blk (struct cs_dsp_coeff_ctl *ctl) { -kfree (ctl->cache); +kvfree (ctl->cache);kfree (ctl->subname);kfree (ctl); }
@@ -1037,7 +1037,7 @@ static int cs_dsp_create_control(struct cs_dsp *dsp, ctl->type = type; ctl->offset = offset; ctl->len = len; - ctl->cache =kzalloc (ctl->len,GFP_KERNEL ); + ctl->cache =kvzalloc (ctl->len,GFP_KERNEL );if (!ctl->cache) { ret = -ENOMEM ; goto err_ctl_subname;
@@ -1055,7 +1055,7 @@ static int cs_dsp_create_control(struct cs_dsp *dsp, err_list_del:list_del (&ctl->list); -kfree (ctl->cache); +kvfree (ctl->cache); err_ctl_subname:kfree (ctl->subname); err_ctl:
Signature · 1 line
2.47.3
Quoted 8 lines · Richard Fitzgerald
Use
kvzalloc()instead ofkzalloc()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.
[...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/1] firmware: cs_dsp: Use kvzalloc() to allocate control caches
commit: c45d5d9803a4fb7d3e7f590094b7a2abcfe74ef6
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark