]> git.alsa-project.org Git - alsa-lib.git/commitdiff
pcm: softvol - fix early exit in add_tlv_info()
authorJaroslav Kysela <perex@perex.cz>
Wed, 2 Jun 2021 17:49:29 +0000 (19:49 +0200)
committerJaroslav Kysela <perex@perex.cz>
Wed, 2 Jun 2021 17:49:29 +0000 (19:49 +0200)
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
src/pcm/pcm_softvol.c

index e2bdd31ae4560f5d12e2a8352901973aed0e43b4..eea322ca046be1eefd6ea18c0cea7f028102bff8 100644 (file)
@@ -711,13 +711,13 @@ static int add_tlv_info(snd_pcm_softvol_t *svol, snd_ctl_elem_info_t *cinfo,
                        unsigned int *old_tlv, size_t old_tlv_size)
 {
        unsigned int tlv[4];
-       if (sizeof(tlv) <= old_tlv_size && memcmp(tlv, old_tlv, sizeof(tlv)) == 0)
-               return 0;
        tlv[SNDRV_CTL_TLVO_TYPE] = SND_CTL_TLVT_DB_SCALE;
        tlv[SNDRV_CTL_TLVO_LEN] = 2 * sizeof(int);
        tlv[SNDRV_CTL_TLVO_DB_SCALE_MIN] = (int)(svol->min_dB * 100);
        tlv[SNDRV_CTL_TLVO_DB_SCALE_MUTE_AND_STEP] =
                (int)((svol->max_dB - svol->min_dB) * 100 / svol->max_val);
+       if (sizeof(tlv) <= old_tlv_size && memcmp(tlv, old_tlv, sizeof(tlv)) == 0)
+               return 0;
        return snd_ctl_elem_tlv_write(svol->ctl, &cinfo->id, tlv);
 }