Hi Andy Thanks for your comments. > -----Original Message----- > From: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx> > Sent: Tuesday, August 20, 2024 6:46 PM > To: Ding, Shenghao <shenghao-ding@xxxxxx> > Cc: broonie@xxxxxxxxxx; lgirdwood@xxxxxxxxx; perex@xxxxxxxx; pierre- > louis.bossart@xxxxxxxxxxxxxxx; 13916275206@xxxxxxx; zhourui@xxxxxxxxxx; > alsa-devel@xxxxxxxxxxxxxxxx; Salazar, Ivan <i-salazar@xxxxxx>; > liam.r.girdwood@xxxxxxxxx; Yue, Jaden <jaden-yue@xxxxxx>; yung- > chuan.liao@xxxxxxxxxxxxxxx; Rao, Dipa <dipa@xxxxxx>; yuhsuan@xxxxxxxxxx; > Lo, Henry <henry.lo@xxxxxx>; tiwai@xxxxxxx; Xu, Baojun <baojun.xu@xxxxxx>; > Baojun.Xu@xxxxxxx; judyhsiao@xxxxxxxxxx; Navada Kanyana, Mukund > <navada@xxxxxx>; cujomalainey@xxxxxxxxxx; Kutty, Aanya <aanya@xxxxxx>; > Mahmud, Nayeem <nayeem.mahmud@xxxxxx>; > savyasanchi.shukla@xxxxxxxxxxxxx; flaviopr@xxxxxxxxxxxxx; Ji, Jesse <jesse- > ji@xxxxxx>; darren.ye@xxxxxxxxxxxx; antheas.dk@xxxxxxxxx; > Jerry2.Huang@xxxxxxxxxxxxxxxxxx; jim.shil@xxxxxxxxxxx > 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 >