summaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorJiaxin Yu <jiaxin.yu@mediatek.com>2022-07-26 18:31:30 +0300
committerMark Brown <broonie@kernel.org>2022-07-26 19:13:31 +0300
commit7df92384c86f36d0452e7abad21c7eaa91aeeef7 (patch)
treee1c18deb05c8ca88f75330d6431a5e9fd9c04547 /sound
parent7209344223f77311aee677ea820a93b9ba0bcae0 (diff)
downloadlinux-7df92384c86f36d0452e7abad21c7eaa91aeeef7.tar.xz
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: b65c466220b3 ("ASoC: mediatek: mt8186: support adda in platform driver") Signed-off-by: Jiaxin Yu <jiaxin.yu@mediatek.com> Link: https://lore.kernel.org/r/20220726153130.27584-1-jiaxin.yu@mediatek.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/mediatek/mt8186/mt8186-dai-adda.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/sound/soc/mediatek/mt8186/mt8186-dai-adda.c b/sound/soc/mediatek/mt8186/mt8186-dai-adda.c
index 6be6d4f3b585..c226d3dace31 100644
--- a/sound/soc/mediatek/mt8186/mt8186-dai-adda.c
+++ b/sound/soc/mediatek/mt8186/mt8186-dai-adda.c
@@ -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;
int dai_id;
- if (strncmp(name, "aud_dac_hires_clk", 7) == 0 ||
- strncmp(name, "aud_adc_hires_clk", 7) == 0)
+ if (strncmp(name, "aud_dac", 7) == 0 || strncmp(name, "aud_adc", 7) == 0)
dai_id = MT8186_DAI_ADDA;
else
return NULL;