Re: [PATCH] ASoc: tas2781: replace devm_kzalloc and scnprintf with devm_kasprintf

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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





[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Pulse Audio]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux