From 35885f6aff39b965592cc2ee4ae5d7d166c34db4 Mon Sep 17 00:00:00 2001 From: "Pawse, GuruprasadX" Date: Wed, 24 Feb 2016 17:03:16 +0530 Subject: [PATCH 069/296] ASoC: Fix TLV control size in TLV handler Size passed to TLV callback is sum of payload size and TLV header. TLV header consumes 8 bytes. The callback handler has to pass the entire data (including TLV header) to drivers. Change-Id: Ic7dcd0d3ab015e340ff907b2dc507b63677cc2ff Tracked-On: Signed-off-by: Pawse, GuruprasadX Signed-off-by: Ramesh Babu Reviewed-on: Reviewed-by: Babu, Ramesh Tested-by: Babu, Ramesh --- sound/soc/soc-ops.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sound/soc/soc-ops.c b/sound/soc/soc-ops.c index 592efb370c44..f5b48d53bc19 100644 --- a/sound/soc/soc-ops.c +++ b/sound/soc/soc-ops.c @@ -764,11 +764,16 @@ int snd_soc_bytes_info_ext(struct snd_kcontrol *kcontrol, } EXPORT_SYMBOL_GPL(snd_soc_bytes_info_ext); +/* TLV header size*/ +#define TLV_HEADER_SIZE (2 * sizeof(unsigned int)) + int snd_soc_bytes_tlv_callback(struct snd_kcontrol *kcontrol, int op_flag, unsigned int size, unsigned int __user *tlv) { struct soc_bytes_ext *params = (void *)kcontrol->private_value; - unsigned int count = size < params->max ? size : params->max; + /* Data includes includes TLV Header */ + unsigned int count = size < (params->max + TLV_HEADER_SIZE) ? + size : (params->max + TLV_HEADER_SIZE); int ret = -ENXIO; switch (op_flag) { -- 2.19.1