Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ASoC: tas2781: replace devm_kzalloc and scnprintf with devm_kstrdup

Replace devm_kzalloc and scnprintf with devm_kstrdup.

Signed-off-by: Shenghao Ding <shenghao-ding@ti.com>
Link: https://patch.msgid.link/20240824060503.1259-1-shenghao-ding@ti.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Shenghao Ding and committed by
Mark Brown
c8dc1016 7db44914

+10 -13
+10 -13
sound/soc/codecs/tas2781-i2c.c
··· 346 346 } 347 347 348 348 /* Create a mixer item for selecting the active profile */ 349 - name = devm_kzalloc(tas_priv->dev, SNDRV_CTL_ELEM_ID_NAME_MAXLEN, 350 - GFP_KERNEL); 349 + name = devm_kstrdup(tas_priv->dev, "Speaker Profile Id", GFP_KERNEL); 351 350 if (!name) { 352 351 ret = -ENOMEM; 353 352 goto out; 354 353 } 355 - scnprintf(name, SNDRV_CTL_ELEM_ID_NAME_MAXLEN, "Speaker Profile Id"); 356 354 prof_ctrls[mix_index].name = name; 357 355 prof_ctrls[mix_index].iface = SNDRV_CTL_ELEM_IFACE_MIXER; 358 356 prof_ctrls[mix_index].info = tasdevice_info_profile; ··· 439 441 goto out; 440 442 } 441 443 442 - /* Create a mixer item for selecting the active profile */ 443 - prog_name = devm_kzalloc(tas_priv->dev, 444 - SNDRV_CTL_ELEM_ID_NAME_MAXLEN, GFP_KERNEL); 445 - conf_name = devm_kzalloc(tas_priv->dev, SNDRV_CTL_ELEM_ID_NAME_MAXLEN, 444 + /* Create mixer items for selecting the active Program and Config */ 445 + prog_name = devm_kstrdup(tas_priv->dev, "Speaker Program Id", 446 446 GFP_KERNEL); 447 - if (!prog_name || !conf_name) { 447 + if (!prog_name) { 448 448 ret = -ENOMEM; 449 449 goto out; 450 450 } 451 - 452 - scnprintf(prog_name, SNDRV_CTL_ELEM_ID_NAME_MAXLEN, 453 - "Speaker Program Id"); 454 451 dsp_ctrls[mix_index].name = prog_name; 455 452 dsp_ctrls[mix_index].iface = SNDRV_CTL_ELEM_IFACE_MIXER; 456 453 dsp_ctrls[mix_index].info = tasdevice_info_programs; ··· 453 460 dsp_ctrls[mix_index].put = tasdevice_program_put; 454 461 mix_index++; 455 462 456 - scnprintf(conf_name, SNDRV_CTL_ELEM_ID_NAME_MAXLEN, 457 - "Speaker Config Id"); 463 + conf_name = devm_kstrdup(tas_priv->dev, "Speaker Config Id", 464 + GFP_KERNEL); 465 + if (!conf_name) { 466 + ret = -ENOMEM; 467 + goto out; 468 + } 458 469 dsp_ctrls[mix_index].name = conf_name; 459 470 dsp_ctrls[mix_index].iface = SNDRV_CTL_ELEM_IFACE_MIXER; 460 471 dsp_ctrls[mix_index].info = tasdevice_info_configurations;