Skip to content

Commit

Permalink
ASoC: fsl_micfil: Enable default case in micfil_set_quality()
Browse files Browse the repository at this point in the history
If 'micfil->quality' received from micfil_quality_set() somehow ends
up with an unpredictable value, switch() operator will fail to
initialize local variable qsel before regmap_update_bits() tries
to utilize it.

While it is unlikely, play it safe and enable a default case that
returns -EINVAL error.

Found by Linux Verification Center (linuxtesting.org) with static
analysis tool SVACE.

Fixes: bea1d61 ("ASoC: fsl_micfil: rework quality setting")
Cc: stable@vger.kernel.org
Signed-off-by: Nikita Zhandarovich <n.zhandarovich@fintech.ru>
Link: https://patch.msgid.link/20250116142436.22389-1-n.zhandarovich@fintech.ru
Signed-off-by: Mark Brown <broonie@kernel.org>
  • Loading branch information
Nikita Zhandarovich authored and Mark Brown committed Feb 3, 2025
1 parent 2014c95 commit a8c9a45
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions sound/soc/fsl/fsl_micfil.c
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,8 @@ static int micfil_set_quality(struct fsl_micfil *micfil)
case QUALITY_VLOW2:
qsel = MICFIL_QSEL_VLOW2_QUALITY;
break;
default:
return -EINVAL;
}

return regmap_update_bits(micfil->regmap, REG_MICFIL_CTRL2,
Expand Down

0 comments on commit a8c9a45

Please sign in to comment.