diff options
author | Pi-Hsun Shih <pihsun@chromium.org> | 2019-03-06 10:09:02 +0100 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2019-03-19 13:51:13 +0100 |
commit | ed1666f6867059e1ed4e2e565a1c87c5580f1b38 (patch) | |
tree | a01b5bb8ebb23c2aac1190888986a3b74e96b859 /sound/soc/mediatek/common | |
parent | ASoC: wm_adsp: Factor out DSP specific operations (diff) | |
download | linux-ed1666f6867059e1ed4e2e565a1c87c5580f1b38.tar.xz linux-ed1666f6867059e1ed4e2e565a1c87c5580f1b38.zip |
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>
Diffstat (limited to 'sound/soc/mediatek/common')
-rw-r--r-- | sound/soc/mediatek/common/mtk-afe-fe-dai.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/sound/soc/mediatek/common/mtk-afe-fe-dai.c b/sound/soc/mediatek/common/mtk-afe-fe-dai.c index cf4978be062f..3830e582e188 100644 --- a/sound/soc/mediatek/common/mtk-afe-fe-dai.c +++ b/sound/soc/mediatek/common/mtk-afe-fe-dai.c @@ -197,11 +197,10 @@ int mtk_afe_fe_trigger(struct snd_pcm_substream *substream, int cmd, switch (cmd) { case SNDRV_PCM_TRIGGER_START: case SNDRV_PCM_TRIGGER_RESUME: - if (memif->data->enable_shift >= 0) - mtk_regmap_update_bits(afe->regmap, - memif->data->enable_reg, - 1 << memif->data->enable_shift, - 1 << memif->data->enable_shift); + mtk_regmap_update_bits(afe->regmap, + memif->data->enable_reg, + 1 << memif->data->enable_shift, + 1 << memif->data->enable_shift); /* set irq counter */ mtk_regmap_update_bits(afe->regmap, irq_data->irq_cnt_reg, |