diff options
author | Colin Ian King <colin.king@canonical.com> | 2017-08-22 17:21:20 +0300 |
---|---|---|
committer | Ben Hutchings <ben@decadent.org.uk> | 2017-11-26 16:51:04 +0300 |
commit | 7a8f94b0198aa17034da702f020411ad996f63e2 (patch) | |
tree | 5440f8d90832a5e7da5a5222008e28842b36ec7f /drivers/media | |
parent | f9f71f3a1e4f36cd4c3493003eb9a0c5c234ca52 (diff) | |
download | linux-7a8f94b0198aa17034da702f020411ad996f63e2.tar.xz |
media: em28xx: calculate left volume level correctly
commit 801e3659bf2c87c31b7024087d61e89e172b5651 upstream.
The calculation of the left volume looks suspect, the value of
0x1f - ((val << 8) & 0x1f) is always 0x1f. The debug prior to the
assignment of value[1] prints the left volume setting using the
calculation 0x1f - (val >> 8) & 0x1f which looks correct to me.
Fix the left volume by using the correct expression as used in
the debug.
Detected by CoverityScan, CID#146140 ("Wrong operator used")
Fixes: 850d24a5a861 ("[media] em28xx-alsa: add mixer support for AC97 volume controls")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Hans Verkuil <hansverk@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
[bwh: Backported to 3.2: adjust filename]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/video/em28xx/em28xx-audio.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/media/video/em28xx/em28xx-audio.c b/drivers/media/video/em28xx/em28xx-audio.c index cff0768afbf5..e902bf571479 100644 --- a/drivers/media/video/em28xx/em28xx-audio.c +++ b/drivers/media/video/em28xx/em28xx-audio.c @@ -507,7 +507,7 @@ static int em28xx_vol_get(struct snd_kcontrol *kcontrol, val, (int)kcontrol->private_value); value->value.integer.value[0] = 0x1f - (val & 0x1f); - value->value.integer.value[1] = 0x1f - ((val << 8) & 0x1f); + value->value.integer.value[1] = 0x1f - ((val >> 8) & 0x1f); return 0; } |