[bug report] ASoC: mediatek: mt8186: support adda in platform driver

Jiaxin Yu jiaxin.yu at mediatek.com
Mon Jul 25 15:11:48 CEST 2022


On Mon, 2022-07-25 at 10:25 +0300, Dan Carpenter wrote:
> Hello Jiaxin Yu,
> 
> The patch b65c466220b3: "ASoC: mediatek: mt8186: support adda in
> platform driver" from May 23, 2022, leads to the following Smatch
> static checker warning:
> 
> 	sound/soc/mediatek/mt8186/mt8186-dai-adda.c:78
> get_adda_priv_by_name()
> 	warn: strncmp() with weird length: 17 vs 7
> 
> sound/soc/mediatek/mt8186/mt8186-dai-adda.c
>     72 static struct mtk_afe_adda_priv *get_adda_priv_by_name(struct
> mtk_base_afe *afe,
>     73                                                        const
> char *name)
>     74 {
>     75         struct mt8186_afe_private *afe_priv = afe-
> >platform_priv;
>     76         int dai_id;
>     77
> --> 78         if (strncmp(name, "aud_dac_hires_clk", 7) == 0 ||
>     79             strncmp(name, "aud_adc_hires_clk", 7) == 0)
> 
> 7 is weird.  It would be more readable to say it as:
> 
> 	if (strncmp(name, "aud_dac", 7) == 0 ||
> 	    strncmp(name, "aud_adc", 7) == 0)
> 
Yes, I will fix it soon.

Thanks,
Jiaxin.Yu

>     80                 dai_id = MT8186_DAI_ADDA;
>     81         else
>     82                 return NULL;
>     83
>     84         return afe_priv->dai_priv[dai_id];
>     85 }
> 
> regards,
> dan carpenter



More information about the Alsa-devel mailing list