Re: [PATCH linux-next] ASoC: Intel: sof_rt5682: use devm_kcalloc() instead of devm_kzalloc()

From: Pierre-Louis Bossart
Date: Fri Sep 16 2022 - 10:24:54 EST




On 9/16/22 08:26, cgel.zte@xxxxxxxxx wrote:
> From: ye xingchen <ye.xingchen@xxxxxxxxxx>
>
> Use 2-factor multiplication argument form devm_kcalloc() instead
> of devm_kzalloc().
>
> Reported-by: Zeal Robot <zealci@xxxxxxxxxx>
> Signed-off-by: ye xingchen <ye.xingchen@xxxxxxxxxx>

Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@xxxxxxxxxxxxxxx>


> ---
> sound/soc/intel/boards/sof_rt5682.c | 15 ++++++++-------
> 1 file changed, 8 insertions(+), 7 deletions(-)
>
> diff --git a/sound/soc/intel/boards/sof_rt5682.c b/sound/soc/intel/boards/sof_rt5682.c
> index 045965312245..1bf9455eaf93 100644
> --- a/sound/soc/intel/boards/sof_rt5682.c
> +++ b/sound/soc/intel/boards/sof_rt5682.c
> @@ -600,10 +600,10 @@ static struct snd_soc_dai_link *sof_card_dai_links_create(struct device *dev,
> struct snd_soc_dai_link *links;
> int i, id = 0;
>
> - links = devm_kzalloc(dev, sizeof(struct snd_soc_dai_link) *
> - sof_audio_card_rt5682.num_links, GFP_KERNEL);
> - cpus = devm_kzalloc(dev, sizeof(struct snd_soc_dai_link_component) *
> - sof_audio_card_rt5682.num_links, GFP_KERNEL);
> + links = devm_kcalloc(dev, sof_audio_card_rt5682.num_links,
> + sizeof(struct snd_soc_dai_link), GFP_KERNEL);
> + cpus = devm_kcalloc(dev, sof_audio_card_rt5682.num_links,
> + sizeof(struct snd_soc_dai_link_component), GFP_KERNEL);
> if (!links || !cpus)
> goto devm_err;
>
> @@ -687,9 +687,10 @@ static struct snd_soc_dai_link *sof_card_dai_links_create(struct device *dev,
>
> /* HDMI */
> if (hdmi_num > 0) {
> - idisp_components = devm_kzalloc(dev,
> - sizeof(struct snd_soc_dai_link_component) *
> - hdmi_num, GFP_KERNEL);
> + idisp_components = devm_kcalloc(dev,
> + hdmi_num,
> + sizeof(struct snd_soc_dai_link_component),
> + GFP_KERNEL);
> if (!idisp_components)
> goto devm_err;
> }