From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796406880; b=2I0jDWKIZEyLVBEN+RdnbzBX9gKpFoDzhtUENn4TGvUzCG2ALfjwUmPDYvdfFrbPVyrl Ai4M6CFH4XieFgrDYt1B9PBZwHBj7R95O6H3D++hdhu1Eq4nLZ2GKBDBzryWf9G6lfsjW 5wmOPr8pVN67+Y7kJYqV+mqVRmsa756uUpb9/8pqrTmftXb8Z+/bLXkNy5eCa/2JWi+Fy N/p1Wy2jEEFcP4gPyiMW2MpGRxXGqpopuBlV8CbmJaxxVe6+4xAdRyxahmCb9Si38Mj05 dWFVk0Q5NfCzRg81zsiIO3uoQgBPknDsOPhy702CqG0l2HSAbZWgnqj7Z91OMyfT78g== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796406880; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=k0voNlLRaYjvXSgtHw7PUds8aCFfIgVVbGRdnG2URUs=; b=i+fc8MjVn6d8rM/GdoAotcFi7Fix+e1EFhV8gqyS1VxV1k66vG79mdo5Ni7AYq56a3Ji JGHSSSrI85mEPgmNBX40FlYUpX2tpTZLl5zoQjMakeZ8Zcup8QjyWv8oiNhUzVas5kqVe oNyTwIM2aH27o45WH7ux1GLjUkoxDp1m/SuyjUCCcOBFr5xicU6G07s5v0fRe6TevWMx4 Fmk4p5ngMlzw8mmvBAzCQNgRiY2rjbARVa4rhQjY+UscNG3ln8sBM7r9s/skV07s2JKOQ 1p5jD3x5CwDrXGEx/6g1/6OapOFv7X8VNylXt4rndZYS50eX8b52zu3DpsGkA8/ziXg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=jrpSqbiv; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 282F8606A322; Fri, 4 Dec 2026 17:54:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=jrpSqbiv Received: by smtp.kernel.org (Postfix) with ESMTPSA id 77A011F0093B; Fri, 4 Dec 2026 17:54:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796406879; bh=k0voNlLRaYjvXSgtHw7PUds8aCFfIgVVbGRdnG2URUs=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=jrpSqbivCA3kyQYd9xjHxaz8vLgboq7JS8JD2x4IC6bU6HRRgx7CPHVY0hHX1rMpM cMxUFnuAyj1uuz2z1JwoVpuD+uyBToEsnCdZbBKD3E9Rn+hyp87se8xywmT6YC95rn Gf+RREUJSg991YsdwUUv3QjthSvRPyvW52Qnjq/LMTjxSZPF675hVMKDCQzkOCQSHT ibMPjZAzD5TAqhlKJvO5juFBare1c6baoeyB2lB2bgYRv3H3OMqrfwX19jHVRkFqk5 MJY0zqs9BJgvAQxawlojQqU2ThlFNluuocpDcnKq5P+XHSdK8Cm7h0/pQapRKruIyX dUQ2qy4Ncjk4Q== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v3 19/19] ASoC: qcom: sc8280xp: allow using the sc8280xp card with lpass-cpu Reply-To: sashiko-reviews@lists.linux.dev To: "Neil Armstrong" Cc: linux-sound@vger.kernel.org, devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org In-Reply-To: <20261204-topic-sm8650-el2-v3-19-8384ef0ac751@linaro.org> References: <20261204-topic-sm8650-el2-v3-0-8384ef0ac751@linaro.org> <20261204-topic-sm8650-el2-v3-19-8384ef0ac751@linaro.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Fri, 04 Dec 2026 17:54:39 +0000 X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 3 potential issues to consider: - [High] ASoC: qcom: sc8280xp: unreachable DSP bypass branch in sc8280xp_add_be_ops() - [High] ASoC: qcom: common: qcom_snd_wcd_jack_setup() breaks Shikra QAIF WCD jack - [Medium] ASoC: qcom: sc8280xp: missing WCD jack cleanup on DSP Bypass link exit -- commit dace9fcff95da852db0ba7dfceee710b6ccfd008 Author: Neil Armstrong ASoC: qcom: sc8280xp: allow using the sc8280xp card with lpass-cpu This commit adds LPASS CPU DAI init and ops callbacks to the sc8280xp machine driver for non-DPCM DSP bypass links, and extends qcom_snd_wcd_jack_setup() to attach the WCD headset jack on LPASS TX codec DMA DAIs. > diff --git a/sound/soc/qcom/common.c b/sound/soc/qcom/common.c > index 77845d43c2194..4b7cda8070b30 100644 > --- a/sound/soc/qcom/common.c > +++ b/sound/soc/qcom/common.c [ ... ] > @@ -420,26 +421,36 @@ int qcom_snd_wcd_jack_setup(struct snd_soc_pcm_runt= ime *rtd, > if (rval) > return rval; > =20 > - switch (cpu_dai->id) { > - case LPI_MI2S_RX_0: > - case TX_CODEC_DMA_TX_0: > - case TX_CODEC_DMA_TX_1: > - case TX_CODEC_DMA_TX_2: > - case TX_CODEC_DMA_TX_3: > - case VA_CODEC_DMA_TX_1: > - for_each_rtd_codec_dais(rtd, i, codec_dai) { > - rval =3D snd_soc_component_set_jack(codec_dai->component, > - jack, NULL); > - if (rval !=3D 0 && rval !=3D -ENOTSUPP) { > - dev_warn(card->dev, "Failed to set jack: %d\n", rval); > - return rval; > - } > + if (qcom_snd_is_dsp_bypass_link(rtd)) { > + switch (cpu_dai->id) { > + case LPASS_CDC_DMA_TX0 ... LPASS_CDC_DMA_TX3: > + break; > + default: > + return 0; > + } > + } else { > + switch (cpu_dai->id) { > + case LPI_MI2S_RX_0: > + case TX_CODEC_DMA_TX_0: > + case TX_CODEC_DMA_TX_1: > + case TX_CODEC_DMA_TX_2: > + case TX_CODEC_DMA_TX_3: > + case VA_CODEC_DMA_TX_1: > + break; > + default: > + return 0; > } > + } > =20 > - break; > - default: > - break; > + for_each_rtd_codec_dais(rtd, i, codec_dai) { > + rval =3D snd_soc_component_set_jack(codec_dai->component, > + jack, NULL); > + if (rval !=3D 0 && rval !=3D -ENOTSUPP) { > + dev_warn(card->dev, "Failed to set jack: %d\n", rval); > + return rval; > + } > } > + > return 0; > } [Severity: High] Does splitting on qcom_snd_is_dsp_bypass_link() regress WCD headset jack setup on Shikra QAIF cards? qcom_snd_is_dsp_bypass_link() returns true whenever neither no_pcm nor dynamic is set. Shikra cards (qcom,shikra-cqm-sndcard and qcom,shikra-cqs-sndcard) also use plain CPU-to-codec links with no platform node, so both flags are zero, yet qaif-shikra.c uses Q6DSP DAI IDs including VA_CODEC_DMA_TX_1 from commit 6d2524f0d360 ("ASoC: qcom: sc8280xp: add backend handling for Shikra sound cards"). With this change, VA_CODEC_DMA_TX_1 takes the bypass branch, misses LPASS_CDC_DMA_TX0 ... LPASS_CDC_DMA_TX3, and returns without calling snd_soc_component_set_jack(), leaving the headset jack detached. > diff --git a/sound/soc/qcom/sc8280xp.c b/sound/soc/qcom/sc8280xp.c > index f655b3ae1d5bf..89f14d4350059 100644 > --- a/sound/soc/qcom/sc8280xp.c > +++ b/sound/soc/qcom/sc8280xp.c [ ... ] > @@ -570,6 +654,10 @@ static void sc8280xp_add_be_ops(struct snd_soc_card = *card) > link->exit =3D sc8280xp_snd_exit; > link->be_hw_params_fixup =3D sc8280xp_be_hw_params_fixup; > link->ops =3D &sc8280xp_be_ops; > + } else if (!link->dynamic) { > + /* DSP Bypass link, neither a DPCM frontend nor a backend */ > + link->init =3D sc8280xp_lpass_snd_init; > + link->ops =3D &sc8280xp_lpass_ops; > } > } > } [Severity: High] Is this new else if (!link->dynamic) branch unreachable dead code? The preceding condition in sc8280xp_add_be_ops() already matches every link where !link->dynamic is true: sound/soc/qcom/sc8280xp.c:sc8280xp_add_be_ops() { ... if (link->no_pcm =3D=3D 1 || !link->dynamic) { link->init =3D sc8280xp_snd_init; link->exit =3D sc8280xp_snd_exit; link->be_hw_params_fixup =3D sc8280xp_be_hw_params_fixup; link->ops =3D &sc8280xp_be_ops; } else if (!link->dynamic) { ... } Because sc8280xp_lpass_snd_init() and sc8280xp_lpass_ops are never attached, lpass-cpu links keep using sc8280xp_snd_init() and sc8280xp_be_ops. Due to overlapping DAI IDs, LPASS_CDC_DMA_TX0..TX3 collide with PRIMARY_MI2S_RX ... QUATERNARY_MI2S_TX in sc8280xp_snd_hw_params() and fail hw_params with -ENOTSUPP when mi2s_mclk_enable or mi2s_bclk_enable is set (lpass-cdc-dma DAIs have no set_sysclk), while LPASS_CDC_DMA_WSA_RX0..1 skip the speaker volume limits and LPASS_DP_RX skips DP jack setup. Simply dropping || !link->dynamic from the first if would regress Shikra QAIF cards from commit 6d2524f0d360 ("ASoC: qcom: sc8280xp: add backend handling for Shikra sound cards"), which also have !no_pcm && !dynamic links using Q6DSP DAI IDs, so lpass-cpu links need to be distinguished from qaif-cpu links explicitly. [Severity: Medium] Can omitting link->exit for DSP bypass links cause a use-after-free on data->jack.jack after card unbind and rebind? sc8280xp_snd_data is devm-allocated on the card platform device, so data->jack and data->jack_setup survive snd_soc_card_unbind() and snd_soc_card_rebind() (for example on component unregister/re-register or bind rollback). During unbind, snd_card_free() frees data->jack.jack through snd_jack_dev_free(), while data->jack_setup stays true because no link->exit callback resets it (and sc8280xp_snd_exit() only clears it for SC8280XP_JACK_SETUP_CODEC). When the card rebinds, sc8280xp_lpass_snd_init() -> qcom_snd_wcd_jack_setup() -> qcom_snd_headset_jack_init() skips recreating data->jack.jack because data->jack_setup is still true, and re-attaches the dangling &data->jack to the WCD codec. The next headset jack event in snd_soc_jack_report() -> snd_jack_report() then dereferences the freed struct snd_jack. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261204-topic-sm86= 50-el2-v3-0-8384ef0ac751@linaro.org?part=3D19