From nobody Thu Jun 25 06:46:15 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 492E8C433F5 for ; Tue, 22 Feb 2022 18:32:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235018AbiBVSc6 (ORCPT ); Tue, 22 Feb 2022 13:32:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52386 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232031AbiBVScy (ORCPT ); Tue, 22 Feb 2022 13:32:54 -0500 Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8E8403BA7F for ; Tue, 22 Feb 2022 10:32:28 -0800 (PST) Received: by mail-wr1-x42b.google.com with SMTP id d28so7342607wra.4 for ; Tue, 22 Feb 2022 10:32:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=a2IntjpP6aGlRoP92/2s3f+MRINe2OeBdydIabsC62Q=; b=fa6fU0ur9L169TRYp27zAxmivEOazbzaB4rd/kLtLTMVeweV7BnaVM3VgK6MW3IYKc +mLLQ5oUeYRHgNP1xo2p6QRJIg9q6yt9bo6AvhELaktVmDZpaQO2gRxEjoVYCb+mvT0e iKvDJy/rTGkHwzIQJWsJOQlHG2uh6jMpSxF11PY7JuGG3NoFeE4oitT4nhAJYHo8cMqE brCEUFzoCQBDtxLkWu/la0p+tn9eyvCEPujnYqPCH5pnq5YbbV1v8pbtrVnJ3keijSNj 0Dho05wNjuKGci7QugL0DXnHBJYf0VONFAoJdGMbkIxpg7Fuq4LoV2OAKeWBfvhRC93C uKKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=a2IntjpP6aGlRoP92/2s3f+MRINe2OeBdydIabsC62Q=; b=qIuj+O17nDt8ANos3+VQmaFW9ZiUzh/sTipL+UHyD8dnwt+qM3QBMAFSsX4g6JBBEe GPFAziLXSH0Kz8ZYFxKA+WJjAhQIk2w8IsMppgbWdtHNQRPfh8jhDAUPO5c6xD3ly3Fi B5QHbmsXRoIbKlEXZhjoMGB/qGcWD/3g7vl6KNJvOBe3lHJYfQB4DtuH2iAOt6Se9UoX LaLmn8AyzSMLnvm4P4XP43TECbyYHrqWN4Nlpu4Jr1EI9hzEBzntkrnQwCXu1s6a+thx ZOPJUiSwPttylm6+GZUD3HLIy52f/b4tq3MewyAjr2fe07oxDYY4rcIoxCl6QC7SdKp+ T4Sg== X-Gm-Message-State: AOAM531m8nONXhK3i9JbcJynfkC2461EUdD+D/SkRLTCjcYpLGxuRfv4 PdJhSncDH1Gd3TrxXAssdFpdPgE8qTrjgQ== X-Google-Smtp-Source: ABdhPJzkFkr4gCWqEerHsP3/wvheZekWZ2fcKAHOo/mOTIilwJkpleU3K3VsYUQJRRfUkpNNoUdvwQ== X-Received: by 2002:a5d:5988:0:b0:1e8:b518:ad7f with SMTP id n8-20020a5d5988000000b001e8b518ad7fmr20021303wri.193.1645554747227; Tue, 22 Feb 2022 10:32:27 -0800 (PST) Received: from srini-hackbox.lan (cpc90716-aztw32-2-0-cust825.18-1.cable.virginm.net. [86.26.103.58]) by smtp.gmail.com with ESMTPSA id l28sm57642165wrz.90.2022.02.22.10.32.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Feb 2022 10:32:26 -0800 (PST) From: Srinivas Kandagatla To: broonie@kernel.org Cc: lgirdwood@gmail.com, perex@perex.cz, tiwai@suse.com, pierre-louis.bossart@linux.intel.com, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, quic_srivasam@quicinc.com, Srinivas Kandagatla Subject: [PATCH v2 1/9] ASoC: codecs: rx-macro: fix accessing compander for aux Date: Tue, 22 Feb 2022 18:32:04 +0000 Message-Id: <20220222183212.11580-2-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20220222183212.11580-1-srinivas.kandagatla@linaro.org> References: <20220222183212.11580-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" AUX interpolator does not have compander, so check before accessing compander data for this. Without this checkan array of out bounds access will be made in comp_enabled[] array. Fixes: 4f692926f562 ("ASoC: codecs: lpass-rx-macro: add dapm widgets and ro= ute") Signed-off-by: Srinivas Kandagatla --- sound/soc/codecs/lpass-rx-macro.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sound/soc/codecs/lpass-rx-macro.c b/sound/soc/codecs/lpass-rx-= macro.c index 2b272a82eabf..32e85d2e9b90 100644 --- a/sound/soc/codecs/lpass-rx-macro.c +++ b/sound/soc/codecs/lpass-rx-macro.c @@ -2039,6 +2039,10 @@ static int rx_macro_load_compander_coeff(struct snd_= soc_component *component, int i; int hph_pwr_mode; =20 + /* AUX does not have compander */ + if (comp =3D=3D INTERP_AUX) + return 0; + if (!rx->comp_enabled[comp]) return 0; =20 --=20 2.21.0 From nobody Thu Jun 25 06:46:15 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C12BEC433FE for ; Tue, 22 Feb 2022 18:32:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235027AbiBVSdA (ORCPT ); Tue, 22 Feb 2022 13:33:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52408 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235005AbiBVScz (ORCPT ); Tue, 22 Feb 2022 13:32:55 -0500 Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A826A12771 for ; Tue, 22 Feb 2022 10:32:29 -0800 (PST) Received: by mail-wr1-x42b.google.com with SMTP id f17so10241412wrh.7 for ; Tue, 22 Feb 2022 10:32:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=y7JyAd12ezNQnJ94i2wAgEHL19WtPs4b74x+OoJQPCY=; b=ZRF1c5KWu1lErY1nstOF8ndQJAhL3OMRzAu+M+DBn6wQu90FPCZWvWArtKYbBI9B0E I9/pQfiglr4/04Zc6rU58HkkAo8k2CAHxvLG3M7gJFbSYpsPBZqq8MhU64bN/TtC60zB 7hDOi/CpZ4Ly278O2Z52mKbNDsbfwRfC1UZBWKNODDtc137sj8SPqBUDrNwtmP+blOVM BwBvwyWUjb7CaHr8BDgGLLxl68nVIGtrql+Qq/pmvl2glAxpEyUgYyvicuJtDQoOfHQn ixAuwvAK05NI100h0h8VNDjEzDknibdb/0M4l5h/x0awufU0zXh+JP1GB4acjrVOkwQC zHtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=y7JyAd12ezNQnJ94i2wAgEHL19WtPs4b74x+OoJQPCY=; b=lFIw83yjS67SphT4SGtzI7v40rCHXEDBe3M6QQfWKPydDT9AVFe00iW3fwSH4jExZi XFQmD90xbZTm65C3MRwoiDOM/EbJjzyzUx1Nm2GbGcEbVkY7wS/UvVkbkn2zj4YTlGlo GmannAWkGgUx0870taI4tN0CoG54igPq5yIAnDucDJOmha9tIK8AOE/8vgNgJY4opeiD 4dw6mzSQfoa3WvVLvPzFBjmFmuWkvaRFtiaDtuZ7zE82UCrASj/yxG7a22YM/GBR3b5s owSTuNW0NksUfBNQowhwHV1EBCZbn4MmJ99nZAgL83m87D6nsf/pP5JhqovYnhBFrq5/ 0kZw== X-Gm-Message-State: AOAM531I+Xv+lZupOgUq4vh1ttJp9kH25h4VwdzkhyPUuPr1qCd3h46a VIWFNY1MBbMjjXlr1v0GPY6oXQ== X-Google-Smtp-Source: ABdhPJzzZEScQ57B6/CcC6Fpa02neArlpb11/SFHUaZIBQjmk3T7P1DGV5DjJkeXijhoqkp+6cQtVw== X-Received: by 2002:a05:6000:104f:b0:1e4:b53a:85d9 with SMTP id c15-20020a056000104f00b001e4b53a85d9mr20384283wrx.594.1645554748244; Tue, 22 Feb 2022 10:32:28 -0800 (PST) Received: from srini-hackbox.lan (cpc90716-aztw32-2-0-cust825.18-1.cable.virginm.net. [86.26.103.58]) by smtp.gmail.com with ESMTPSA id l28sm57642165wrz.90.2022.02.22.10.32.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Feb 2022 10:32:27 -0800 (PST) From: Srinivas Kandagatla To: broonie@kernel.org Cc: lgirdwood@gmail.com, perex@perex.cz, tiwai@suse.com, pierre-louis.bossart@linux.intel.com, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, quic_srivasam@quicinc.com, Srinivas Kandagatla Subject: [PATCH v2 2/9] ASoC: codecs: rx-macro: fix accessing array out of bounds for enum type Date: Tue, 22 Feb 2022 18:32:05 +0000 Message-Id: <20220222183212.11580-3-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20220222183212.11580-1-srinivas.kandagatla@linaro.org> References: <20220222183212.11580-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Accessing enums using integer would result in array out of bounds access on platforms like aarch64 where sizeof(long) is 8 compared to enum size which is 4 bytes. Fixes: 4f692926f562 ("ASoC: codecs: lpass-rx-macro: add dapm widgets and ro= ute") Signed-off-by: Srinivas Kandagatla --- sound/soc/codecs/lpass-rx-macro.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sound/soc/codecs/lpass-rx-macro.c b/sound/soc/codecs/lpass-rx-= macro.c index 32e85d2e9b90..3a3dc0539d92 100644 --- a/sound/soc/codecs/lpass-rx-macro.c +++ b/sound/soc/codecs/lpass-rx-macro.c @@ -2272,7 +2272,7 @@ static int rx_macro_mux_get(struct snd_kcontrol *kcon= trol, struct snd_soc_component *component =3D snd_soc_dapm_to_component(widget-= >dapm); struct rx_macro *rx =3D snd_soc_component_get_drvdata(component); =20 - ucontrol->value.integer.value[0] =3D + ucontrol->value.enumerated.item[0] =3D rx->rx_port_value[widget->shift]; return 0; } @@ -2284,7 +2284,7 @@ static int rx_macro_mux_put(struct snd_kcontrol *kcon= trol, struct snd_soc_component *component =3D snd_soc_dapm_to_component(widget-= >dapm); struct soc_enum *e =3D (struct soc_enum *)kcontrol->private_value; struct snd_soc_dapm_update *update =3D NULL; - u32 rx_port_value =3D ucontrol->value.integer.value[0]; + u32 rx_port_value =3D ucontrol->value.enumerated.item[0]; u32 aif_rst; struct rx_macro *rx =3D snd_soc_component_get_drvdata(component); =20 @@ -2396,7 +2396,7 @@ static int rx_macro_get_hph_pwr_mode(struct snd_kcont= rol *kcontrol, struct snd_soc_component *component =3D snd_soc_kcontrol_component(kcontr= ol); struct rx_macro *rx =3D snd_soc_component_get_drvdata(component); =20 - ucontrol->value.integer.value[0] =3D rx->hph_pwr_mode; + ucontrol->value.enumerated.item[0] =3D rx->hph_pwr_mode; return 0; } =20 @@ -2406,7 +2406,7 @@ static int rx_macro_put_hph_pwr_mode(struct snd_kcont= rol *kcontrol, struct snd_soc_component *component =3D snd_soc_kcontrol_component(kcontr= ol); struct rx_macro *rx =3D snd_soc_component_get_drvdata(component); =20 - rx->hph_pwr_mode =3D ucontrol->value.integer.value[0]; + rx->hph_pwr_mode =3D ucontrol->value.enumerated.item[0]; return 0; } =20 --=20 2.21.0 From nobody Thu Jun 25 06:46:15 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BF2FEC4332F for ; Tue, 22 Feb 2022 18:32:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235038AbiBVSdB (ORCPT ); Tue, 22 Feb 2022 13:33:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52454 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235011AbiBVSc4 (ORCPT ); Tue, 22 Feb 2022 13:32:56 -0500 Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BAE195E16A for ; Tue, 22 Feb 2022 10:32:30 -0800 (PST) Received: by mail-wm1-x32e.google.com with SMTP id p14-20020a05600c1d8e00b0037f881182a8so2633795wms.2 for ; Tue, 22 Feb 2022 10:32:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=AUoqmx1Ywbc+tqd2GvIO663zQffqPunv+0z/Zs4V7Gs=; b=aSdNImbOjNhtLdxQBITj50ZagnfribzgmqnjcSU+5VA32tXHznQ0f6KsVc3i7B84L3 BXF0c5YRa4/QvyygttsC+cm5BfIU77kwq2VedJCBG/Qg3Sd1FGo0KA3TC3MHUk7vrXpV LxuvL3T2Y+d1LOY39dDWjAXponQL8x4ALTe6Rqob/m7c9zySZ2t5L5KOroeH3WmHKeyw CEFCjPKHrVkmEs8SvqRMycmIdYwQWhrcmgFRc6vd9Py+OI5SXqo4AeaIdzSUP2YbOG29 U95yQXtC2fxWPEehrUNhUek5TA06g+qGzT0sS/vZltX8QdDU9pD9ZridBAJN0Aww2v2B BZMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=AUoqmx1Ywbc+tqd2GvIO663zQffqPunv+0z/Zs4V7Gs=; b=ZNTwi9I7W+u8t0a8M9K+AERWH0gwW1t7AvtlZr8tEuIopcsf+aRsIzB6li4ZsGpxgF scEjeHdnbO0MKDcSw5ls6wV6onrKxuwdjoyjz6l55jwrLaTCQ3yGU2Hcz8QZjCad+qjZ FFC8oJAKKUo9uhUO3GicRa2LTPfRwjTbB97XNBc6hH55wpeoO/qoZIoZBc2TnbjioOlA 2WPsfKlfYRNRPyEmsMlpzWusW/Cj+3Zh1mJF6xYO1EQVUl4V13O3drXIZ6fBU7DxEMTQ jnXmIA7VaZVvC8cwcDfItVfvmWF6W30JaK1QI5TmUqcjUO0QjGlubppll+tWkJgkGLPz VPew== X-Gm-Message-State: AOAM530PLAuXxh4ldLDe+/pzZ3hbcA/k9azHedEmHe6/N4kZ4FhFQ05f QkR7DAwJ+Utht8YbJCAJuXBi4Q== X-Google-Smtp-Source: ABdhPJxBe9KWmKY4uNCJTcsJ69pn0Df4nH0t+gILLI62HOXElU6N4yV8HIXFDDF5ISzjRAHqXemhAg== X-Received: by 2002:a05:600c:290:b0:37f:a999:e9a6 with SMTP id 16-20020a05600c029000b0037fa999e9a6mr4286281wmk.9.1645554749357; Tue, 22 Feb 2022 10:32:29 -0800 (PST) Received: from srini-hackbox.lan (cpc90716-aztw32-2-0-cust825.18-1.cable.virginm.net. [86.26.103.58]) by smtp.gmail.com with ESMTPSA id l28sm57642165wrz.90.2022.02.22.10.32.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Feb 2022 10:32:28 -0800 (PST) From: Srinivas Kandagatla To: broonie@kernel.org Cc: lgirdwood@gmail.com, perex@perex.cz, tiwai@suse.com, pierre-louis.bossart@linux.intel.com, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, quic_srivasam@quicinc.com, Srinivas Kandagatla Subject: [PATCH v2 3/9] ASoC: codecs: tx-macro: fix accessing array out of bounds for enum type Date: Tue, 22 Feb 2022 18:32:06 +0000 Message-Id: <20220222183212.11580-4-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20220222183212.11580-1-srinivas.kandagatla@linaro.org> References: <20220222183212.11580-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Accessing enums using integer would result in array out of bounds access on platforms like aarch64 where sizeof(long) is 8 compared to enum size which is 4 bytes. Also few return value of put functions, so that change notifications are sent correctly. Fixes: c39667ddcfc5 ("ASoC: codecs: lpass-tx-macro: add support for lpass t= x macro") Signed-off-by: Srinivas Kandagatla --- sound/soc/codecs/lpass-tx-macro.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sound/soc/codecs/lpass-tx-macro.c b/sound/soc/codecs/lpass-tx-= macro.c index 9c96ab1bf84f..7347d79a6329 100644 --- a/sound/soc/codecs/lpass-tx-macro.c +++ b/sound/soc/codecs/lpass-tx-macro.c @@ -997,7 +997,7 @@ static int tx_macro_dec_mode_get(struct snd_kcontrol *k= control, struct soc_enum *e =3D (struct soc_enum *)kcontrol->private_value; int path =3D e->shift_l; =20 - ucontrol->value.integer.value[0] =3D tx->dec_mode[path]; + ucontrol->value.enumerated.item[0] =3D tx->dec_mode[path]; =20 return 0; } @@ -1006,14 +1006,14 @@ static int tx_macro_dec_mode_put(struct snd_kcontro= l *kcontrol, struct snd_ctl_elem_value *ucontrol) { struct snd_soc_component *component =3D snd_soc_kcontrol_component(kcontr= ol); - int value =3D ucontrol->value.integer.value[0]; + int value =3D ucontrol->value.enumerated.item[0]; struct soc_enum *e =3D (struct soc_enum *)kcontrol->private_value; int path =3D e->shift_l; struct tx_macro *tx =3D snd_soc_component_get_drvdata(component); =20 tx->dec_mode[path] =3D value; =20 - return 0; + return 1; } =20 static int tx_macro_get_bcs(struct snd_kcontrol *kcontrol, @@ -1036,7 +1036,7 @@ static int tx_macro_set_bcs(struct snd_kcontrol *kcon= trol, =20 tx->bcs_enable =3D value; =20 - return 0; + return 1; } =20 static int tx_macro_hw_params(struct snd_pcm_substream *substream, --=20 2.21.0 From nobody Thu Jun 25 06:46:15 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 20B32C433F5 for ; Tue, 22 Feb 2022 18:32:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235061AbiBVSdE (ORCPT ); Tue, 22 Feb 2022 13:33:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52482 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235015AbiBVSc5 (ORCPT ); Tue, 22 Feb 2022 13:32:57 -0500 Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B21CDCFB94 for ; Tue, 22 Feb 2022 10:32:31 -0800 (PST) Received: by mail-wr1-x432.google.com with SMTP id d17so241027wrc.9 for ; Tue, 22 Feb 2022 10:32:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=2QZz8ASXss+gfpOAKkDwr+gWAwAdXQYtNmwvaBY30o0=; b=PUVWweJs2/2O32Gy46OrYrDIIpF+i7Om8rp92BVlIoi95NIXn7DzXPWS1FCmqdRmJ9 Fq11XK6G3DlSILHq7jq67p6QqaohcX3UDv2bm2LINSWHyZ10UaVCmGixyryIblgZgdbo ahZ83ghJDir0lwMemh0wyNjXy4K4vMxd//ito95JwUZBtSFcYoJxLgIStaqu5inIVQc8 ad/75IsjnGZ6/OaHYcS3j4h2TDZoOocwvqGuuxRyWs8S19+b+PPlC/88JbAGzZD4BtbE GfvAbJBVjGvdLnbqOPlHEZIBdl8/tdHNwqGJCM5ADUKprNSFGQfYPIfaS/5akfHq5gRc 9sRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=2QZz8ASXss+gfpOAKkDwr+gWAwAdXQYtNmwvaBY30o0=; b=foUIC0YD5jDXdDJ6AtspEPi7O1Dmbfz9abLzdzCqezsKjCyxu4NS4lI+3cjcPbig3q SeoLIypQGIv9tKUk6hN7jVtBhW0TiTomK60sajepkRYXhwfqsTY6oJa0xgxMewuP762z qZGqdfTz6hsfXk5g6d2l5wYZrHpVtWjjOTHFzujaKFJ83q9eloD+YXpBlIIq/Eq9X3lZ exfJW+RNmlXrmmMn+CJrtp1KpR+iWTcyG+tFFX/tdXAfb3WyQ2fq9MlrSmlhi+C7X77I E6GGzBBQVbbNJ4njFOtUqWiERzqJn+UcXunjrLWtR9hdo9vsJj68D8HzH+dF2a5UbxQ2 EYNg== X-Gm-Message-State: AOAM530J9YF2+AZlh6tv4Iz3N9l5lbXxJvmdkmaBJJLFNQwSdBmjqfQA CQs/pLVSRK21ky/yxiiqtfjVWA9h5f59Ug== X-Google-Smtp-Source: ABdhPJyxTDVpwUPAosm4aHtqCWhd+dyKFZGHxVAsLjrwCuLfN5Ne4PJ6ODBR/1iomV5X/XXdO5Vq/A== X-Received: by 2002:a5d:46d2:0:b0:1e4:a653:e010 with SMTP id g18-20020a5d46d2000000b001e4a653e010mr21743448wrs.77.1645554750328; Tue, 22 Feb 2022 10:32:30 -0800 (PST) Received: from srini-hackbox.lan (cpc90716-aztw32-2-0-cust825.18-1.cable.virginm.net. [86.26.103.58]) by smtp.gmail.com with ESMTPSA id l28sm57642165wrz.90.2022.02.22.10.32.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Feb 2022 10:32:29 -0800 (PST) From: Srinivas Kandagatla To: broonie@kernel.org Cc: lgirdwood@gmail.com, perex@perex.cz, tiwai@suse.com, pierre-louis.bossart@linux.intel.com, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, quic_srivasam@quicinc.com, Srinivas Kandagatla Subject: [PATCH v2 4/9] ASoC: codecs: va-macro: fix accessing array out of bounds for enum type Date: Tue, 22 Feb 2022 18:32:07 +0000 Message-Id: <20220222183212.11580-5-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20220222183212.11580-1-srinivas.kandagatla@linaro.org> References: <20220222183212.11580-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Accessing enums using integer would result in array out of bounds access on platforms like aarch64 where sizeof(long) is 8 compared to enum size which is 4 bytes. Fixes: 908e6b1df26e ("ASoC: codecs: lpass-va-macro: Add support to VA Macro= ") Signed-off-by: Srinivas Kandagatla --- sound/soc/codecs/lpass-va-macro.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/soc/codecs/lpass-va-macro.c b/sound/soc/codecs/lpass-va-= macro.c index 11147e35689b..e14c277e6a8b 100644 --- a/sound/soc/codecs/lpass-va-macro.c +++ b/sound/soc/codecs/lpass-va-macro.c @@ -780,7 +780,7 @@ static int va_macro_dec_mode_get(struct snd_kcontrol *k= control, struct soc_enum *e =3D (struct soc_enum *)kcontrol->private_value; int path =3D e->shift_l; =20 - ucontrol->value.integer.value[0] =3D va->dec_mode[path]; + ucontrol->value.enumerated.item[0] =3D va->dec_mode[path]; =20 return 0; } @@ -789,7 +789,7 @@ static int va_macro_dec_mode_put(struct snd_kcontrol *k= control, struct snd_ctl_elem_value *ucontrol) { struct snd_soc_component *comp =3D snd_soc_kcontrol_component(kcontrol); - int value =3D ucontrol->value.integer.value[0]; + int value =3D ucontrol->value.enumerated.item[0]; struct soc_enum *e =3D (struct soc_enum *)kcontrol->private_value; int path =3D e->shift_l; struct va_macro *va =3D snd_soc_component_get_drvdata(comp); --=20 2.21.0 From nobody Thu Jun 25 06:46:15 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 99810C433FE for ; Tue, 22 Feb 2022 18:32:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235067AbiBVSdH (ORCPT ); Tue, 22 Feb 2022 13:33:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52534 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232031AbiBVSc6 (ORCPT ); Tue, 22 Feb 2022 13:32:58 -0500 Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BE913B3E6B for ; Tue, 22 Feb 2022 10:32:32 -0800 (PST) Received: by mail-wr1-x429.google.com with SMTP id p9so35078032wra.12 for ; Tue, 22 Feb 2022 10:32:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=pJUEubD8UMpBZteKL+cVLlZyMNg5UU9numn2ZyAs5ps=; b=JIVjPZX+CZlzxYoovRe150vIu193GQdJn3n2+d7YaMqvZ/CXwAuZeTFikwrq+ift7s AyVTcP32EyjgeoVodaWS80wh2q2Eu54pK39w38+RhTpjZeHKrmPJgzQhdQz9YBTtvjL1 lZfA2hE9/bzt2t3Zm0dNv1HErSSOqo81KE7b1/lSvO0X8dFvUCWic5udoXaGJpKd+aW3 CYt8IoPnu6grnaBZy6HgevnnFgPArT3kqa/tueutiQbPjcOd0n1T0ZX5QcZCYkSgbaGz 8NACenIIFGmqY/78XG5z37ShvtUBVc2KY6gSR6Pqa+x5ri8zwhYU9fqGFVdfOtNkvmLD JipQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=pJUEubD8UMpBZteKL+cVLlZyMNg5UU9numn2ZyAs5ps=; b=7Krbwf4Wl/ACakOrWQ/diNLg/44MyhMJZd/DrLKs7q0Y1q/64ZF3vJGK8egdtTvah9 lOBNy7GjavBgXEjbGZUxTXyAPKzhQgkIxxy02j92snbkR72PcT0X5rHhpV6doo/wMlYT hf7mQCNF1S8M3SXfo6cKn4Vj8ZGpYAZfG32cBEi82PEs2deoqtc14sa8uNYZD2l8xwhh VI6Lnq+iaY0ZmNtI3Q80nO8PvSYPN09STmOR1I54AYyS5MfKVY3Qcl5z9Obj6hUq8mLM 2cltsOCN7JTXJKlz4SdycYP/C2LcHup84gjYveZuyddriLdU7c16M5gC1h1R0nkYaeQm wUMQ== X-Gm-Message-State: AOAM531O3sw0TtTlxIgLizev9HNizvOrzIle7sIJn4ahCi09v+UM6tTP VHiInE2tfULJPB0Zq+fqRNUcgw== X-Google-Smtp-Source: ABdhPJzMsf+fs7MdsLfjKZHb5fhJT1XI6B8Km4xMkkbBk+s0Mqk9MZGbT93a2y+fvAq7lAINJUKLvw== X-Received: by 2002:adf:ec03:0:b0:1e4:98f6:2563 with SMTP id x3-20020adfec03000000b001e498f62563mr20446293wrn.168.1645554751362; Tue, 22 Feb 2022 10:32:31 -0800 (PST) Received: from srini-hackbox.lan (cpc90716-aztw32-2-0-cust825.18-1.cable.virginm.net. [86.26.103.58]) by smtp.gmail.com with ESMTPSA id l28sm57642165wrz.90.2022.02.22.10.32.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Feb 2022 10:32:30 -0800 (PST) From: Srinivas Kandagatla To: broonie@kernel.org Cc: lgirdwood@gmail.com, perex@perex.cz, tiwai@suse.com, pierre-louis.bossart@linux.intel.com, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, quic_srivasam@quicinc.com, Srinivas Kandagatla Subject: [PATCH v2 5/9] ASoC: codecs: wsa-macro: fix accessing array out of bounds for enum type Date: Tue, 22 Feb 2022 18:32:08 +0000 Message-Id: <20220222183212.11580-6-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20220222183212.11580-1-srinivas.kandagatla@linaro.org> References: <20220222183212.11580-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Accessing enums using integer would result in array out of bounds access on platforms like aarch64 where sizeof(long) is 8 compared to enum size which is 4 bytes. Also fix return value of put function, so that change notifications are sent correctly. Fixes: 2c4066e5d428 ("ASoC: codecs: lpass-wsa-macro: add dapm widgets and r= oute") Signed-off-by: Srinivas Kandagatla --- sound/soc/codecs/lpass-wsa-macro.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sound/soc/codecs/lpass-wsa-macro.c b/sound/soc/codecs/lpass-ws= a-macro.c index 69d2915f40d8..ddde17e2dc35 100644 --- a/sound/soc/codecs/lpass-wsa-macro.c +++ b/sound/soc/codecs/lpass-wsa-macro.c @@ -1805,7 +1805,7 @@ static int wsa_macro_ear_spkr_pa_gain_get(struct snd_= kcontrol *kcontrol, struct snd_soc_component *component =3D snd_soc_kcontrol_component(kcontr= ol); struct wsa_macro *wsa =3D snd_soc_component_get_drvdata(component); =20 - ucontrol->value.integer.value[0] =3D wsa->ear_spkr_gain; + ucontrol->value.enumerated.item[0] =3D wsa->ear_spkr_gain; =20 return 0; } @@ -1816,7 +1816,7 @@ static int wsa_macro_ear_spkr_pa_gain_put(struct snd_= kcontrol *kcontrol, struct snd_soc_component *component =3D snd_soc_kcontrol_component(kcontr= ol); struct wsa_macro *wsa =3D snd_soc_component_get_drvdata(component); =20 - wsa->ear_spkr_gain =3D ucontrol->value.integer.value[0]; + wsa->ear_spkr_gain =3D ucontrol->value.enumerated.item[0]; =20 return 0; } @@ -1830,7 +1830,7 @@ static int wsa_macro_rx_mux_get(struct snd_kcontrol *= kcontrol, snd_soc_dapm_to_component(widget->dapm); struct wsa_macro *wsa =3D snd_soc_component_get_drvdata(component); =20 - ucontrol->value.integer.value[0] =3D + ucontrol->value.enumerated.item[0] =3D wsa->rx_port_value[widget->shift]; return 0; } @@ -1844,7 +1844,7 @@ static int wsa_macro_rx_mux_put(struct snd_kcontrol *= kcontrol, snd_soc_dapm_to_component(widget->dapm); struct soc_enum *e =3D (struct soc_enum *)kcontrol->private_value; struct snd_soc_dapm_update *update =3D NULL; - u32 rx_port_value =3D ucontrol->value.integer.value[0]; + u32 rx_port_value =3D ucontrol->value.enumerated.item[0]; u32 bit_input; u32 aif_rst; struct wsa_macro *wsa =3D snd_soc_component_get_drvdata(component); @@ -1887,7 +1887,7 @@ static int wsa_macro_rx_mux_put(struct snd_kcontrol *= kcontrol, =20 snd_soc_dapm_mux_update_power(widget->dapm, kcontrol, rx_port_value, e, update); - return 0; + return 1; } =20 static int wsa_macro_soft_clip_enable_get(struct snd_kcontrol *kcontrol, --=20 2.21.0 From nobody Thu Jun 25 06:46:15 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 57C06C433F5 for ; Tue, 22 Feb 2022 18:32:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235071AbiBVSdM (ORCPT ); Tue, 22 Feb 2022 13:33:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52578 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235021AbiBVSc7 (ORCPT ); Tue, 22 Feb 2022 13:32:59 -0500 Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [IPv6:2a00:1450:4864:20::335]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C3B2B9E9EE for ; Tue, 22 Feb 2022 10:32:33 -0800 (PST) Received: by mail-wm1-x335.google.com with SMTP id c192so12166513wma.4 for ; Tue, 22 Feb 2022 10:32:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ht2zsDCw6mTpQAlwd9QIJhSI+uSP7rAlJbSv+42FdW4=; b=LXUOfvYcs0kbsRz+8veIC8emfQuSsGfkrwhm84FAWeP9sc3AI+0gN0owZNz+Zr72pY cIAKJyS4Gub9M71Vn2dsP4KurE2gzAozuSkzWPopWbzIIIDVrCC9lo5yVnRmZyuv8apq bq3hSG/PvG/efxwji5GBYA0YoTOaPOIau9kF2l3M8rR6QoJxNxkzQvnuA+QUVWZTiRem Q0GcIFB73m2Wyh3aTZJKXEE+jhJwEpG1rDVCnI3V/SxWCAlaWl5yaI07DOGu2z4B+LzX N0hB1DBPZ/RIpP7cWo20uCgw6RSQp/JCb/U3jONsszLTAbYxKt22RZ7Oird9AZ4rvs76 BGyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ht2zsDCw6mTpQAlwd9QIJhSI+uSP7rAlJbSv+42FdW4=; b=rSwLYFGdvLFiyVch15yJVYY0cnZaGHiKHbdYw1Vh53wEmks8s9kQhbWu8U6jaL4zvF uPsVDlFu5nXliEZgbqY8D0Gb6MY/dkpTIKchjmWryriwgZ9n+OCOi8rx7bViD/4A6Eh8 2eIEu3S+OQwRpS0Mv4a3WGvepsPJizl6NzIqvzZtTK1688TmGlSOnqUmBXVtaDzWfgv7 o36B32+EsG0+IldmiwdmhyeB+wklgb2F8aqmTO4X/b1EIOWhqEiV+6ysVfkq4KKAjgL7 0JebOCsDf+dXp0u04VC8ZTmOxxEhgNtNWAvsp8J0+g4daebz2hIjs3/kS+j6lB7zMwuA WC0g== X-Gm-Message-State: AOAM533KcrpKia/jY/ym/W3kOGJBeSOyIvsUyCw0+pMDmAusxF40OXlc 8/jadSh4fEy0HxrK3qLICCem2w== X-Google-Smtp-Source: ABdhPJyRSJz2xS81gFD3nqaVdA3VppkmlAX5k2fgyY5ea3oCaj0wITSJje5BPCTZboDEjS4yLjtmyg== X-Received: by 2002:a05:600c:a03:b0:37b:daff:6146 with SMTP id z3-20020a05600c0a0300b0037bdaff6146mr4479777wmp.85.1645554752394; Tue, 22 Feb 2022 10:32:32 -0800 (PST) Received: from srini-hackbox.lan (cpc90716-aztw32-2-0-cust825.18-1.cable.virginm.net. [86.26.103.58]) by smtp.gmail.com with ESMTPSA id l28sm57642165wrz.90.2022.02.22.10.32.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Feb 2022 10:32:31 -0800 (PST) From: Srinivas Kandagatla To: broonie@kernel.org Cc: lgirdwood@gmail.com, perex@perex.cz, tiwai@suse.com, pierre-louis.bossart@linux.intel.com, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, quic_srivasam@quicinc.com, Srinivas Kandagatla Subject: [PATCH v2 6/9] ASoC: codecs: wc938x: fix accessing array out of bounds for enum type Date: Tue, 22 Feb 2022 18:32:09 +0000 Message-Id: <20220222183212.11580-7-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20220222183212.11580-1-srinivas.kandagatla@linaro.org> References: <20220222183212.11580-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Accessing enums using integer would result in array out of bounds access on platforms like aarch64 where sizeof(long) is 8 compared to enum size which is 4 bytes. Fix this by using enumerated items instead of integers. Fixes: e8ba1e05bdc0 ("ASoC: codecs: wcd938x: add basic controls") Signed-off-by: Srinivas Kandagatla --- sound/soc/codecs/wcd938x.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/soc/codecs/wcd938x.c b/sound/soc/codecs/wcd938x.c index cf61d23bfb1c..deecc83eb592 100644 --- a/sound/soc/codecs/wcd938x.c +++ b/sound/soc/codecs/wcd938x.c @@ -2506,7 +2506,7 @@ static int wcd938x_tx_mode_get(struct snd_kcontrol *k= control, struct soc_enum *e =3D (struct soc_enum *)kcontrol->private_value; int path =3D e->shift_l; =20 - ucontrol->value.integer.value[0] =3D wcd938x->tx_mode[path]; + ucontrol->value.enumerated.item[0] =3D wcd938x->tx_mode[path]; =20 return 0; } @@ -2530,7 +2530,7 @@ static int wcd938x_rx_hph_mode_get(struct snd_kcontro= l *kcontrol, struct snd_soc_component *component =3D snd_soc_kcontrol_component(kcontr= ol); struct wcd938x_priv *wcd938x =3D snd_soc_component_get_drvdata(component); =20 - ucontrol->value.integer.value[0] =3D wcd938x->hph_mode; + ucontrol->value.enumerated.item[0] =3D wcd938x->hph_mode; =20 return 0; } --=20 2.21.0 From nobody Thu Jun 25 06:46:15 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8D256C433EF for ; Tue, 22 Feb 2022 18:32:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235081AbiBVSdP (ORCPT ); Tue, 22 Feb 2022 13:33:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52684 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235037AbiBVSdB (ORCPT ); Tue, 22 Feb 2022 13:33:01 -0500 Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DDF83B65FB for ; Tue, 22 Feb 2022 10:32:34 -0800 (PST) Received: by mail-wr1-x436.google.com with SMTP id u1so35073167wrg.11 for ; Tue, 22 Feb 2022 10:32:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Gs0UQYeLXZEFiZSAa7cijQLwxToifauUEWbaq2HVPLo=; b=SG8yKfuDMo92Gj+ppDPWnH5Z/qVOKABWnTVjTMNpa5Blh2Lh7NmjPfENG/wwsBjGym gZQTS7fycdhAyz/lVF7KAqAjbpy8a/or4Dk3cQC7HAxo1Yzmj9oreNJtPBHiQkUxvVVD gOMKXgrFD+VD1YeWaBjA0x65zJlhaX4olAuUpJm9M4s8rnrPhFgaX43CjdyFYtX43SLo 2B/FiQyuL8+6ALRpNVzEDqT1dM3rsOFDR1jzvPi0tYx2NIdAJnOnAODkHSu4bwWcInLW 4jPwv+ULu9yNl/Tzl+dqpBDGLrS6p+/9hSaLT5U5hxtBEa71KZv4if7zn/87DjG7j5TB Cq0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Gs0UQYeLXZEFiZSAa7cijQLwxToifauUEWbaq2HVPLo=; b=3H6rzdC6yVFW23FLRD9Y80dYGacVMZFPEng3Hlx1Fi5cWaTCe+auUVOlHA4wmLfAJ1 RWP+rqVX3z3PfCQif6Us/o6ewqWAAekAJkBh2Vajdl2Ij854uPKsmy56q+vXomujZApO axHxIqIRrFHpNyDnxrDoy5OUfzb6AFgIEzWw0OJ5bgoGmYLqF+w5P86PoXTBA/U0eal1 kS3hMpEbnY2/hREjbPPYsbs3cfPX29CckagPZxaCZVyFaCZn4SfMyG4hwJCuoyExRVTV +XjLigU7WYgMiaHJfikdML4NM2wkRpHNWU+JJrDZbFWJ0FIHeRKrM02QeVtt+rD0n86q hh8g== X-Gm-Message-State: AOAM530fCkbV9k/Bd/AgTOsVxIWIPwNSsyWtGkuZvHBTleCCPMC61FbB wC0Q9XUrG3jwRlPaZgt2tpu/9w== X-Google-Smtp-Source: ABdhPJx9ufhte9u4mOwDexPtu1IQtPstNEvnTrTxaGq3xRUlczgS5HyGu7VLb7Ai7VgEWDiOd3HhMA== X-Received: by 2002:a5d:45ca:0:b0:1ea:9bf9:ce5a with SMTP id b10-20020a5d45ca000000b001ea9bf9ce5amr2408659wrs.620.1645554753408; Tue, 22 Feb 2022 10:32:33 -0800 (PST) Received: from srini-hackbox.lan (cpc90716-aztw32-2-0-cust825.18-1.cable.virginm.net. [86.26.103.58]) by smtp.gmail.com with ESMTPSA id l28sm57642165wrz.90.2022.02.22.10.32.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Feb 2022 10:32:33 -0800 (PST) From: Srinivas Kandagatla To: broonie@kernel.org Cc: lgirdwood@gmail.com, perex@perex.cz, tiwai@suse.com, pierre-louis.bossart@linux.intel.com, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, quic_srivasam@quicinc.com, Srinivas Kandagatla Subject: [PATCH v2 7/9] ASoC: codecs: wcd938x: fix kcontrol max values Date: Tue, 22 Feb 2022 18:32:10 +0000 Message-Id: <20220222183212.11580-8-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20220222183212.11580-1-srinivas.kandagatla@linaro.org> References: <20220222183212.11580-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" set "HPH Type" Kcontrol max value of WCD_MBHC_HPH_STEREO instead of UINT_MA= X. set "HPHL/R Impedance" Kcontrols max value to INT_MAX instead of UINT_MAX as max field is integer type. Without this patch amixer for these controls will show -1 as max value to u= serspace. Fixes: bcee7ed09b8e ("ASoC: codecs: wcd938x: add Multi Button Headset Contr= ol support") Signed-off-by: Srinivas Kandagatla --- sound/soc/codecs/wcd938x.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sound/soc/codecs/wcd938x.c b/sound/soc/codecs/wcd938x.c index deecc83eb592..782877db8c3c 100644 --- a/sound/soc/codecs/wcd938x.c +++ b/sound/soc/codecs/wcd938x.c @@ -3577,14 +3577,14 @@ static int wcd938x_hph_impedance_get(struct snd_kco= ntrol *kcontrol, } =20 static const struct snd_kcontrol_new hph_type_detect_controls[] =3D { - SOC_SINGLE_EXT("HPH Type", 0, 0, UINT_MAX, 0, + SOC_SINGLE_EXT("HPH Type", 0, 0, WCD_MBHC_HPH_STEREO, 0, wcd938x_get_hph_type, NULL), }; =20 static const struct snd_kcontrol_new impedance_detect_controls[] =3D { - SOC_SINGLE_EXT("HPHL Impedance", 0, 0, UINT_MAX, 0, + SOC_SINGLE_EXT("HPHL Impedance", 0, 0, INT_MAX, 0, wcd938x_hph_impedance_get, NULL), - SOC_SINGLE_EXT("HPHR Impedance", 0, 1, UINT_MAX, 0, + SOC_SINGLE_EXT("HPHR Impedance", 0, 1, INT_MAX, 0, wcd938x_hph_impedance_get, NULL), }; =20 --=20 2.21.0 From nobody Thu Jun 25 06:46:15 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CBCB7C433EF for ; Tue, 22 Feb 2022 18:32:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235109AbiBVSdU (ORCPT ); Tue, 22 Feb 2022 13:33:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52616 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235040AbiBVSdB (ORCPT ); Tue, 22 Feb 2022 13:33:01 -0500 Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D206D1070BA for ; Tue, 22 Feb 2022 10:32:35 -0800 (PST) Received: by mail-wr1-x432.google.com with SMTP id d3so19460795wrf.1 for ; Tue, 22 Feb 2022 10:32:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=9SOM2m1l2t9AVsCxObqTWKpNPnvoS4HHumlCtnLuW+M=; b=sfphTkw+TIFpSiVfPCDWpMWe0C1Hsg7TxDv/6tfs6owKtzUL1mTcl48e3eStB74Lry uIssrDlUyTqB/NWDuogXlOJicUGDIxOIRoOklIWCxm/G59moqOpR/KO2kpdJAvB9Dbjb OpNJsrrUggRFjN3EJ9mi+XzfPV36vrKFTxix6WBQRJGaphTeLj837GYeNQ+67NZZRZ33 CzFcOzTK8yOoOIh8/noDccHBda9/RW/EpdSy7Lkoh7h9ohKJDcJzrlGWNx/N6TrPhC0p Nyon9yBws48hbyhjumRz7VOjjcOhMGNOShwsB/3BQnJYZCi+3FsHMYCACVW+rdSr7KNB 1p+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=9SOM2m1l2t9AVsCxObqTWKpNPnvoS4HHumlCtnLuW+M=; b=oTWbervQLTLZphC3+qcoetxFd28xJFOaWeFdaK7ukL/CPEIe3kM1DDGl6bp4CPvKuL LxZCKzH/El4jRrQKz02NXuHStrBt/b/PWXtdCASRJuHKmvH7aTcJT+hI5H1H1XVoCFoq ad0R9lF16Z4LJsStbBmsODHm6+SxyQq9iWg81HymQMBm4SKHQnRShdsbTakWtTsRuE66 EXjCHQDb2rSgoEsmbFwISaYJujIrU0QG5vUWKcYA0lwNfq5xzve2LVk1UsCKL4xK/kdc N/OuqxcjY/u4jgupx0BBvHusuUOPCvk6jD/WEA5gxOesOD/1pt/uvCv1ktHwRMLijXdP rY+A== X-Gm-Message-State: AOAM530cpYfZWgSw2V6EADGxbMd+NQ2Vbr1S4d87lsyqeOmAaD9G0Gtc hC7123nxvLeN6m3xNDJvWOaJFg== X-Google-Smtp-Source: ABdhPJzB9kZCiPNVRCRgOj5KpMPtb6jZTEiWIL2vVd2Ge5yGwr0q0OgrFnxxtDDpv23Msgbzlkcb2Q== X-Received: by 2002:a05:6000:3c6:b0:1e4:a380:bb53 with SMTP id b6-20020a05600003c600b001e4a380bb53mr20490779wrg.559.1645554754454; Tue, 22 Feb 2022 10:32:34 -0800 (PST) Received: from srini-hackbox.lan (cpc90716-aztw32-2-0-cust825.18-1.cable.virginm.net. [86.26.103.58]) by smtp.gmail.com with ESMTPSA id l28sm57642165wrz.90.2022.02.22.10.32.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Feb 2022 10:32:34 -0800 (PST) From: Srinivas Kandagatla To: broonie@kernel.org Cc: lgirdwood@gmail.com, perex@perex.cz, tiwai@suse.com, pierre-louis.bossart@linux.intel.com, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, quic_srivasam@quicinc.com, Srinivas Kandagatla Subject: [PATCH v2 8/9] ASoC: codecs: wcd934x: fix kcontrol max values Date: Tue, 22 Feb 2022 18:32:11 +0000 Message-Id: <20220222183212.11580-9-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20220222183212.11580-1-srinivas.kandagatla@linaro.org> References: <20220222183212.11580-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" set "HPH Type" Kcontrol max value of WCD_MBHC_HPH_STEREO instead of UINT_MA= X. set "HPHL/R Impedance" Kcontrols max value to INT_MAX instead of UINT_MAX as max field is integer type. Without this patch amixer for these controls will show -1 as max value to u= serspace. Fixes: 9fb9b1690f0b ("ASoC: codecs: wcd934x: add mbhc support") Signed-off-by: Srinivas Kandagatla --- sound/soc/codecs/wcd934x.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sound/soc/codecs/wcd934x.c b/sound/soc/codecs/wcd934x.c index 6c468527fec6..f2674905a4a7 100644 --- a/sound/soc/codecs/wcd934x.c +++ b/sound/soc/codecs/wcd934x.c @@ -3023,14 +3023,14 @@ static int wcd934x_hph_impedance_get(struct snd_kco= ntrol *kcontrol, return 0; } static const struct snd_kcontrol_new hph_type_detect_controls[] =3D { - SOC_SINGLE_EXT("HPH Type", 0, 0, UINT_MAX, 0, + SOC_SINGLE_EXT("HPH Type", 0, 0, WCD_MBHC_HPH_STEREO, 0, wcd934x_get_hph_type, NULL), }; =20 static const struct snd_kcontrol_new impedance_detect_controls[] =3D { - SOC_SINGLE_EXT("HPHL Impedance", 0, 0, UINT_MAX, 0, + SOC_SINGLE_EXT("HPHL Impedance", 0, 0, INT_MAX, 0, wcd934x_hph_impedance_get, NULL), - SOC_SINGLE_EXT("HPHR Impedance", 0, 1, UINT_MAX, 0, + SOC_SINGLE_EXT("HPHR Impedance", 0, 1, INT_MAX, 0, wcd934x_hph_impedance_get, NULL), }; =20 --=20 2.21.0 From nobody Thu Jun 25 06:46:15 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7B543C433EF for ; Tue, 22 Feb 2022 18:33:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233014AbiBVSdc (ORCPT ); Tue, 22 Feb 2022 13:33:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52700 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235056AbiBVSdE (ORCPT ); Tue, 22 Feb 2022 13:33:04 -0500 Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EFCCB10782C for ; Tue, 22 Feb 2022 10:32:36 -0800 (PST) Received: by mail-wm1-x336.google.com with SMTP id n29-20020a05600c3b9d00b00380e379bae2so1220779wms.3 for ; Tue, 22 Feb 2022 10:32:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=KSXL61TJ4FNLzWo1z0RhBOi7zjEjelC9n+5VWaG+Gtc=; b=LOawPkVnk1MoWqXpWg+WWqin6xRMXhzW4CLjSSOhnuq+96bpU6bSNdNC/i2q8xxCxU pD7o8rNuHyRITWoTZzNmgrO8VQX0+5qvwi6++2BjpM8LQbsaC8GVdmwGyGDyp2qdaW/A nwPt+QvZNxnUnk7uGrfM/jc4F7I6LjHiST6yseSPN84zlakeiK/xAmzG8elnlIWDNFF6 aXuyrcOwDCwH+2AjdPF/Q0uQo+KRibmh8Bfajko2eqMdVqXRQe8bCviaLxssJFnHJAvA BrVdS30ex+AOTwkyt0kivVyTgcU84ldmZDLMxz4/jyCeO3CzYRATJKgmy1Y8ZPnZikX3 PjOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=KSXL61TJ4FNLzWo1z0RhBOi7zjEjelC9n+5VWaG+Gtc=; b=Y8tKsHdsh1nAPIi0AtbzC+dwPXWgQLMA4kNsI1yQ69mWxplRk6+uE7NjmZblsOHVgJ sbsT4WU5SJrKCD1NlhAJJDuDnLU068hpEe3vj0Ckcr3ynDdN5+HEmjBkD1gjpRy3d4bW vUX8br3Cv5WZlNrVujzlaQTiVtgWfw6BbLl6b0bSbJNAGtQKz09Gkk7iU9M3wcOiipzC cL9Mh6CxUmp4LhdhKS+v7xOq1QgHHeXH3QSd8R79T+DTcr7rsb3NCmGxSuKQRxNDng7O NCt+WDitMgOppU2Y40Dd3vWx2zBKg8+L79ULRJRE71LqbzZ9X2tW+PEMQVtF9jA84vGb JOyg== X-Gm-Message-State: AOAM531dT2knKNOqXi00/dSroVfvj7N3FxZvkqe8J6AZBYpBDt6PmR+r 8BzFHJ/L8I4Ymyee5legRepE1Q== X-Google-Smtp-Source: ABdhPJzdgtosvehWqrOxuEsYt+VvH5/nC7aOJ9BODdKou2VckN37w33Q/6riYz0ejmzxIro7uicoJA== X-Received: by 2002:a1c:a915:0:b0:380:e3de:b78f with SMTP id s21-20020a1ca915000000b00380e3deb78fmr1724213wme.19.1645554755595; Tue, 22 Feb 2022 10:32:35 -0800 (PST) Received: from srini-hackbox.lan (cpc90716-aztw32-2-0-cust825.18-1.cable.virginm.net. [86.26.103.58]) by smtp.gmail.com with ESMTPSA id l28sm57642165wrz.90.2022.02.22.10.32.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Feb 2022 10:32:35 -0800 (PST) From: Srinivas Kandagatla To: broonie@kernel.org Cc: lgirdwood@gmail.com, perex@perex.cz, tiwai@suse.com, pierre-louis.bossart@linux.intel.com, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, quic_srivasam@quicinc.com, Srinivas Kandagatla Subject: [PATCH v2 9/9] ASoC: codecs: wcd934x: fix return value of wcd934x_rx_hph_mode_put Date: Tue, 22 Feb 2022 18:32:12 +0000 Message-Id: <20220222183212.11580-10-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20220222183212.11580-1-srinivas.kandagatla@linaro.org> References: <20220222183212.11580-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" wcd934x_rx_hph_mode_put currently returns zero eventhough it changes the va= lue. Fix this, so that change notifications are sent correctly. Fixes: 1cde8b822332 ("ASoC: wcd934x: add basic controls") Signed-off-by: Srinivas Kandagatla --- sound/soc/codecs/wcd934x.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sound/soc/codecs/wcd934x.c b/sound/soc/codecs/wcd934x.c index f2674905a4a7..40b414867872 100644 --- a/sound/soc/codecs/wcd934x.c +++ b/sound/soc/codecs/wcd934x.c @@ -3308,13 +3308,16 @@ static int wcd934x_rx_hph_mode_put(struct snd_kcont= rol *kc, =20 mode_val =3D ucontrol->value.enumerated.item[0]; =20 + if (mode_val =3D=3D wcd->hph_mode) + return 0; + if (mode_val =3D=3D 0) { dev_err(wcd->dev, "Invalid HPH Mode, default to ClSH HiFi\n"); mode_val =3D CLS_H_LOHIFI; } wcd->hph_mode =3D mode_val; =20 - return 0; + return 1; } =20 static int slim_rx_mux_get(struct snd_kcontrol *kc, --=20 2.21.0