summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaroslav Kysela <perex@perex.cz>2021-06-02 19:49:29 +0200
committerJaroslav Kysela <perex@perex.cz>2021-06-02 19:49:29 +0200
commiteabadf545c51d4c88c5f359db73726ec3ac653ba (patch)
treee9148ca558bf3f5329fb397ecbe4855eb8e277b1
parent74c6382df6cf18b801659d8c5c53407a7ea1f02b (diff)
downloadalsa-lib-eabadf545c51d4c88c5f359db73726ec3ac653ba.tar.gz
pcm: softvol - fix early exit in add_tlv_info()
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
-rw-r--r--src/pcm/pcm_softvol.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/pcm/pcm_softvol.c b/src/pcm/pcm_softvol.c
index e2bdd31a..eea322ca 100644
--- a/src/pcm/pcm_softvol.c
+++ b/src/pcm/pcm_softvol.c
@@ -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);
}