Skip to content

Commit 6c52e58

Browse files
nehebbroonie
authored andcommitted
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>
1 parent 98d08b2 commit 6c52e58

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

sound/soc/mediatek/mt2701/mt2701-afe-clock-ctrl.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ static const char *const base_clks[] = {
2525
int mt2701_init_clock(struct mtk_base_afe *afe)
2626
{
2727
struct mt2701_afe_private *afe_priv = afe->platform_priv;
28+
int i2s_num;
2829
int i;
2930

3031
for (i = 0; i < MT2701_BASE_CLK_NUM; i++) {
@@ -35,8 +36,9 @@ int mt2701_init_clock(struct mtk_base_afe *afe)
3536
}
3637
}
3738

39+
i2s_num = min(afe_priv->soc->i2s_num, MT2701_BASE_CLK_NUM);
3840
/* Get I2S related clocks */
39-
for (i = 0; i < afe_priv->soc->i2s_num; i++) {
41+
for (i = 0; i < i2s_num; i++) {
4042
struct mt2701_i2s_path *i2s_path = &afe_priv->i2s_path[i];
4143
struct clk *i2s_ck;
4244
char name[13];

0 commit comments

Comments
 (0)