summaryrefslogtreecommitdiffstats
path: root/alsa-binding/Alsa-AddCtl.c
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2017-10-31 16:17:27 +0100
committerJosé Bollo <jose.bollo@iot.bzh>2017-11-01 12:20:40 +0100
commitdff24533071f260d3c77f1563b0cb7b7ddec1a9b (patch)
tree05616d3709a5b9797ad2824f30c421fb169add80 /alsa-binding/Alsa-AddCtl.c
parent6ab4414105cea0377a5a5e8c941196f759174d31 (diff)
fix allocation size
Change-Id: Ia1a2ed447fd9b5831eec58606a0f7694e6569017 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
Diffstat (limited to 'alsa-binding/Alsa-AddCtl.c')
-rw-r--r--alsa-binding/Alsa-AddCtl.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/alsa-binding/Alsa-AddCtl.c b/alsa-binding/Alsa-AddCtl.c
index 3f969c1..108a590 100644
--- a/alsa-binding/Alsa-AddCtl.c
+++ b/alsa-binding/Alsa-AddCtl.c
@@ -74,12 +74,12 @@ static const unsigned int *allocate_int_dbscale_tlv(int min, int step, int mute)
static const unsigned int *allocate_int_linear_tlv(int max, int min) {
// SNDRV_CTL_TLVD_DECLARE_DB_LINEAR (range, min, max);
- size_t tlvSize = sizeof (4 * sizeof (unsigned int));
- unsigned int *tlv = malloc(tlvSize);
+ size_t tlvSize = 4 * sizeof (unsigned int);
+ unsigned int *tlv = malloc(4 * sizeof (unsigned int));
tlv[0] = SNDRV_CTL_TLVT_DB_LINEAR;
- tlv[1] = (int) tlvSize;
- tlv[2] = -min * 100;
- tlv[3] = max * 100;
+ tlv[1] = (unsigned int)(2 * sizeof (unsigned int));
+ tlv[2] = (unsigned int)(-min * 100);
+ tlv[3] = (unsigned int)(max * 100);
return tlv;
}