20 Aug
2024
20 Aug
'24
12:46 p.m.
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.
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?
--
With Best Regards,
Andy Shevchenko