]> git.alsa-project.org Git - alsa-lib.git/commitdiff
hcontrol: use position offset macro of TLV data
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>
Tue, 15 May 2018 12:36:36 +0000 (21:36 +0900)
committerTakashi Iwai <tiwai@suse.de>
Tue, 15 May 2018 16:03:12 +0000 (18:03 +0200)
A series of SNDRV_CTL_TLVO_XXX macro was introduced for position offset
of TLV data. This commit applies a code optimization.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
src/control/hcontrol.c

index 7e7752483fb8d37eb5e174c411b9cb65f24a8f8f..0cac89567c84b52ae85a009582f2bf7dff6fd8f6 100644 (file)
@@ -870,7 +870,7 @@ int snd_hctl_elem_tlv_write(snd_hctl_elem_t *elem, const unsigned int *tlv)
 {
        assert(elem);
        assert(tlv);
-       assert(tlv[1] >= 4);
+       assert(tlv[SNDRV_CTL_TLVO_LEN] >= 4);
        return snd_ctl_elem_tlv_write(elem->hctl->ctl, &elem->id, tlv);
 }
 
@@ -886,7 +886,7 @@ int snd_hctl_elem_tlv_command(snd_hctl_elem_t *elem, const unsigned int *tlv)
 {
        assert(elem);
        assert(tlv);
-       assert(tlv[1] >= 4);
+       assert(tlv[SNDRV_CTL_TLVO_LEN] >= 4);
        return snd_ctl_elem_tlv_command(elem->hctl->ctl, &elem->id, tlv);
 }