ASoC: tas2781: replace devm_kzalloc and scnprintf with devm_kstrdup
Subsystems (3)
Shenghao Ding
maintainerPATCH v2 1/1 ASoC: tas2781: replace devm_kzalloc and scnprintf with devm_kstrdup
Replace devm_kzalloc and scnprintf with devm_kstrdup.
---
v2:
- use devm_kstrdup instead of devm_kasprintf
--- sound/soc/codecs/tas2781-i2c.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-)
sound/soc/codecs/tas2781-i2c.c +10 -13
@@ -346,13 +346,11 @@ static int tasdevice_create_control(struct tasdevice_priv *tas_priv) }/* Create a mixer item for selecting the active profile */ - name =devm_kzalloc (tas_priv->dev,SNDRV_CTL_ELEM_ID_NAME_MAXLEN , -GFP_KERNEL ); + name =devm_kstrdup (tas_priv->dev,"Speaker Profile Id" ,GFP_KERNEL );if (!name) { ret = -ENOMEM ; goto out; } -scnprintf (name,SNDRV_CTL_ELEM_ID_NAME_MAXLEN ,"Speaker Profile Id" ); prof_ctrls[mix_index].name = name; prof_ctrls[mix_index].iface =SNDRV_CTL_ELEM_IFACE_MIXER ; prof_ctrls[mix_index].info = tasdevice_info_profile;
@@ -441,18 +439,13 @@ static int tasdevice_dsp_create_ctrls(struct tasdevice_priv *tas_priv) goto out; } -/* Create a mixer item for selecting the active profile */ - prog_name =devm_kzalloc (tas_priv->dev, -SNDRV_CTL_ELEM_ID_NAME_MAXLEN ,GFP_KERNEL ); - conf_name =devm_kzalloc (tas_priv->dev,SNDRV_CTL_ELEM_ID_NAME_MAXLEN , +/* Create mixer items for selecting the active Program and Config */ + prog_name =devm_kstrdup (tas_priv->dev,"Speaker Program Id" ,GFP_KERNEL ); -if (!prog_name || !conf_name) { +if (!prog_name) { ret = -ENOMEM ; goto out; } - -scnprintf (prog_name,SNDRV_CTL_ELEM_ID_NAME_MAXLEN , -"Speaker Program Id" ); dsp_ctrls[mix_index].name = prog_name; dsp_ctrls[mix_index].iface =SNDRV_CTL_ELEM_IFACE_MIXER ; dsp_ctrls[mix_index].info = tasdevice_info_programs;
@@ -460,8 +453,12 @@ static int tasdevice_dsp_create_ctrls(struct tasdevice_priv *tas_priv) dsp_ctrls[mix_index].put = tasdevice_program_put; mix_index++; -scnprintf (conf_name,SNDRV_CTL_ELEM_ID_NAME_MAXLEN , -"Speaker Config Id" ); + conf_name =devm_kstrdup (tas_priv->dev,"Speaker Config Id" , +GFP_KERNEL ); +if (!conf_name) { + ret = -ENOMEM ; + goto out; + } dsp_ctrls[mix_index].name = conf_name; dsp_ctrls[mix_index].iface =SNDRV_CTL_ELEM_IFACE_MIXER ; dsp_ctrls[mix_index].info = tasdevice_info_configurations;
Signature · 1 line
2.34.1
Quoted 1 line · Shenghao Ding
Replace
devm_kzallocand scnprintf withdevm_kstrdup.
We refer to the functions as func(). Please, fix this in the Subject and commit message.
...
sound/soc/codecs/tas2781-i2c.c static int tasdevice_dsp_create_ctrls(struct tasdevice_priv *tas_priv) · line 457
Quoted 2 lines
sound/soc/codecs/tas2781-i2c.c +2
-0+ conf_name =devm_kstrdup (tas_priv->dev,"Speaker Config Id" , +GFP_KERNEL );
Can be squeezed to a single line.
...
Other than above, LGTM.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Mark Brown
maintainerQuoted 3 lines · Shenghao Ding
Replace
devm_kzallocand scnprintf withdevm_kstrdup.
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/1] ASoC: tas2781: replace devm_kzalloc and scnprintf with devm_kstrdup
commit: c8dc1016ba0e249e45863c1da3b951efe7c4214a
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