Skip to content

Commit 6e611d9

Browse files
Krzysztof Kozlowskigregkh
authored andcommitted
ASoC: codecs: nau8325: Silence uninitialized variables warnings
commit 2c7e5e1 upstream. clang W=1 builds warn: nau8325.c:430:13: error: variable 'n2_max' is uninitialized when used here [-Werror,-Wuninitialized] which are false positive, because the variables will be always initialized when used (guarded by mclk_max!=0 check). However initializing them upfront makes the code more obvious and easier, plus it silences the warning. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com> Link: https://patch.msgid.link/20251203140611.87191-2-krzysztof.kozlowski@oss.qualcomm.com Signed-off-by: Mark Brown <broonie@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 5588b7c commit 6e611d9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

sound/soc/codecs/nau8325.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,8 @@ static int nau8325_clksrc_choose(struct nau8325 *nau8325,
386386
const struct nau8325_srate_attr **srate_table,
387387
int *n1_sel, int *mult_sel, int *n2_sel)
388388
{
389-
int i, j, mclk, mclk_max, ratio, ratio_sel, n2_max;
389+
int i, j, mclk, ratio;
390+
int mclk_max = 0, ratio_sel = 0, n2_max = 0;
390391

391392
if (!nau8325->mclk || !nau8325->fs)
392393
goto proc_err;
@@ -408,7 +409,6 @@ static int nau8325_clksrc_choose(struct nau8325 *nau8325,
408409
}
409410

410411
/* Get MCLK_SRC through 1/N, Multiplier, and then 1/N2. */
411-
mclk_max = 0;
412412
for (i = 0; i < ARRAY_SIZE(mclk_n1_div); i++) {
413413
for (j = 0; j < ARRAY_SIZE(mclk_n3_mult); j++) {
414414
mclk = nau8325->mclk << mclk_n3_mult[j].param;

0 commit comments

Comments
 (0)