未验证 提交 7df92384 编写于 作者: J Jiaxin Yu 提交者: Mark Brown

ASoC: mediatek: mt8186: set the correct string to strncmp()

Fix Smatch static checker warning. strncmp() here only needs to compare
the first seven bytes, so in order to make the code more clear, only the
first seven bytes of the string used as the comparison are reserved.

Bug report: https://www.spinics.net/lists/alsa-devel/msg145608.html

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)

Fixes: b65c4662 ("ASoC: mediatek: mt8186: support adda in platform driver")
Signed-off-by: NJiaxin Yu <jiaxin.yu@mediatek.com>
Link: https://lore.kernel.org/r/20220726153130.27584-1-jiaxin.yu@mediatek.comSigned-off-by: NMark Brown <broonie@kernel.org>
上级 72093442
...@@ -75,8 +75,7 @@ static struct mtk_afe_adda_priv *get_adda_priv_by_name(struct mtk_base_afe *afe, ...@@ -75,8 +75,7 @@ static struct mtk_afe_adda_priv *get_adda_priv_by_name(struct mtk_base_afe *afe,
struct mt8186_afe_private *afe_priv = afe->platform_priv; struct mt8186_afe_private *afe_priv = afe->platform_priv;
int dai_id; int dai_id;
if (strncmp(name, "aud_dac_hires_clk", 7) == 0 || if (strncmp(name, "aud_dac", 7) == 0 || strncmp(name, "aud_adc", 7) == 0)
strncmp(name, "aud_adc_hires_clk", 7) == 0)
dai_id = MT8186_DAI_ADDA; dai_id = MT8186_DAI_ADDA;
else else
return NULL; return NULL;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册