]> git.baikalelectronics.ru Git - kernel.git/commit
ASoC: mediatek: Fix UBSAN warning.
authorPi-Hsun Shih <pihsun@chromium.org>
Wed, 6 Mar 2019 09:09:02 +0000 (17:09 +0800)
committerMark Brown <broonie@kernel.org>
Tue, 19 Mar 2019 12:51:13 +0000 (12:51 +0000)
commitf0dc4b5fc9cad7b69414602d989a40adbe5235f3
treea01b5bb8ebb23c2aac1190888986a3b74e96b859
parent94190ae537d8b733135f267722ad86a025f7e5df
ASoC: mediatek: Fix UBSAN warning.

In sound/soc/mediatek/common/mtk-afe-fe-dai.c, when xxx_reg is -1, it's
a no-op to call mtk_regmap_update_bits, but since both xxx_reg and
xxx_shift are set to -1, the (1 << xxx_shift) in the argument would
trigger a UBSAN warning.

Fix the warning by setting those xxx_shift to 0 instead.

Note that since the code explicitly checks .mono_shift >= 0 and
.fs_shift >= 0 before using them in '<<' operator, those two members are
not set to 0.

Signed-off-by: Pi-Hsun Shih <pihsun@chromium.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/mediatek/common/mtk-afe-fe-dai.c
sound/soc/mediatek/mt2701/mt2701-afe-pcm.c
sound/soc/mediatek/mt6797/mt6797-afe-pcm.c
sound/soc/mediatek/mt8173/mt8173-afe-pcm.c
sound/soc/mediatek/mt8183/mt8183-afe-pcm.c