]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
media: em28xx: calculate left volume level correctly
authorColin Ian King <colin.king@canonical.com>
Tue, 22 Aug 2017 14:21:20 +0000 (10:21 -0400)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Sat, 26 Aug 2017 18:31:49 +0000 (14:31 -0400)
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>
drivers/media/usb/em28xx/em28xx-audio.c

index 261620a57420bdcf9fe8abfe7b1079536f54f427..4628d73f46f29a2a4e540731447e843cf8f4a6cc 100644 (file)
@@ -564,7 +564,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;
 }