diff options
| author | Rosen Penev <rosenp@gmail.com> | 2026-05-22 04:45:15 +0300 |
|---|---|---|
| committer | Mark Brown <broonie@kernel.org> | 2026-06-01 16:59:59 +0300 |
| commit | 6c52e58dbdaed2eea6cd10461e6b7fb3de4c99d5 (patch) | |
| tree | 8cc70b76db5410d35a739a519019b18782db3991 | |
| parent | 98d08b2e0e92ea39ac6743dcfdda1af676514c4b (diff) | |
| download | linux-6c52e58dbdaed2eea6cd10461e6b7fb3de4c99d5.tar.xz | |
ASoC: mediatek: mt2701: fix snprintf bounds
For whatever reason, GCC is unable to figure out that i2s_num is a
single digit number, with MT2701_BASE_CLK_NUM being the maximum value it
represents. Add a min() call to help it out and fix W=1 errors regarding
snprintf bounds.
Signed-off-by: Rosen Penev <rosenp@gmail.com>
Link: https://patch.msgid.link/20260522014515.719973-1-rosenp@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
| -rw-r--r-- | sound/soc/mediatek/mt2701/mt2701-afe-clock-ctrl.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/sound/soc/mediatek/mt2701/mt2701-afe-clock-ctrl.c b/sound/soc/mediatek/mt2701/mt2701-afe-clock-ctrl.c index 5a2bcf027b4f..d217f9320ad2 100644 --- a/sound/soc/mediatek/mt2701/mt2701-afe-clock-ctrl.c +++ b/sound/soc/mediatek/mt2701/mt2701-afe-clock-ctrl.c @@ -25,6 +25,7 @@ static const char *const base_clks[] = { int mt2701_init_clock(struct mtk_base_afe *afe) { struct mt2701_afe_private *afe_priv = afe->platform_priv; + int i2s_num; int i; for (i = 0; i < MT2701_BASE_CLK_NUM; i++) { @@ -35,8 +36,9 @@ int mt2701_init_clock(struct mtk_base_afe *afe) } } + i2s_num = min(afe_priv->soc->i2s_num, MT2701_BASE_CLK_NUM); /* Get I2S related clocks */ - for (i = 0; i < afe_priv->soc->i2s_num; i++) { + for (i = 0; i < i2s_num; i++) { struct mt2701_i2s_path *i2s_path = &afe_priv->i2s_path[i]; struct clk *i2s_ck; char name[13]; |
