Hi Andy Thanks for your comments.
-----Original Message----- From: Andy Shevchenko andriy.shevchenko@linux.intel.com Sent: Tuesday, August 20, 2024 6:46 PM To: Ding, Shenghao shenghao-ding@ti.com Cc: broonie@kernel.org; lgirdwood@gmail.com; perex@perex.cz; pierre- louis.bossart@linux.intel.com; 13916275206@139.com; zhourui@huaqin.com; alsa-devel@alsa-project.org; Salazar, Ivan i-salazar@ti.com; liam.r.girdwood@intel.com; Yue, Jaden jaden-yue@ti.com; yung- chuan.liao@linux.intel.com; Rao, Dipa dipa@ti.com; yuhsuan@google.com; Lo, Henry henry.lo@ti.com; tiwai@suse.de; Xu, Baojun baojun.xu@ti.com; Baojun.Xu@fpt.com; judyhsiao@google.com; Navada Kanyana, Mukund navada@ti.com; cujomalainey@google.com; Kutty, Aanya aanya@ti.com; Mahmud, Nayeem nayeem.mahmud@ti.com; savyasanchi.shukla@netradyne.com; flaviopr@microsoft.com; Ji, Jesse <jesse- ji@ti.com>; darren.ye@mediatek.com; antheas.dk@gmail.com; Jerry2.Huang@lcfuturecenter.com; jim.shil@goertek.com Subject: [EXTERNAL] Re: [PATCH] ASoc: tas2781: replace devm_kzalloc and scnprintf with devm_kasprintf
On Tue, Aug 20, 2024 at 01: 09: 24PM +0800, Shenghao Ding wrote: > Replace devm_kzalloc and scnprintf with devm_kasprintf. We refer to functions as func() [mind the parentheses]. .. . > + name = devm_kasprintf(tas_priv->dev, GFP_KERNEL, ZjQcmQRYFpfptBannerStart This message was sent from outside of Texas Instruments. Do not click links or open attachments unless you recognize the source of this email and know the content is safe. https://us-phishalarm- ewt.proofpoint.com/EWT/v1/G3vK!uBdnVXvGNoHUwG8oNvKLEKxWzmhYG82 GpsitRhNsb0P1mOVL0znkPABZUh4PJ5lEeMlWbeMkT3aHKGSKjzs$ Report Suspicious
ZjQcmQRYFpfptBannerEnd On Tue, Aug 20, 2024 at 01:09:24PM +0800, Shenghao Ding wrote:
Replace devm_kzalloc and scnprintf with devm_kasprintf.
We refer to functions as func() [mind the parentheses].
...
- name = devm_kasprintf(tas_priv->dev, GFP_KERNEL, "Speaker Profile
+Id");
These three do not use any formatting strings. Effectively it simply devm_kstrdup() in all cases. But see the Q below.
Accept.
if (!name) { ret = -ENOMEM; goto out; }
- /* Create mixer items for selecting the active Program and Config */
- prog_name = devm_kasprintf(tas_priv->dev, GFP_KERNEL,
"Speaker Program Id");
- if (!prog_name) { ret = -ENOMEM; goto out; }
- conf_name = devm_kasprintf(tas_priv->dev, GFP_KERNEL, "Speaker Config Id");
- if (!conf_name) {
ret = -ENOMEM;
goto out;
- }
So, why all these may not be constant literals assigned directly to the respective data structures?
The total of Profile, config and program are different with the bin file. It can't be set to the fixed value.
-- With Best Regards, Andy Shevchenko