All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Mohammad Rafi Shaik" <mohammad.rafi.shaik@oss.qualcomm.com>
Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v5 8/9] ASoC: qcom: lpass-tx-macro: Add support for Bolero v4.0
Date: Wed, 14 Oct 2026 09:35:27 +0000	[thread overview]
Message-ID: <sashiko-outbox-171080@kernel.org> (raw)
In-Reply-To: <20261014-add_shikra_support_v5-v5-8-fb9f0667e613@oss.qualcomm.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] cleanup: Mixing goto-based error handling with __free() scope-based cleanup
- [Medium] ASoC: qcom: lpass-tx-macro: SWR_MIC bitwise check misidentifies RX_SWR_MIC
--

commit 64e799e2b76860a53ceff3f36c16c6368d70c60e
Author: Prasad Kumpatla <prasad.kumpatla@oss.qualcomm.com>

ASoC: qcom: lpass-tx-macro: Add support for Bolero v4.0

This commit adds support for the Bolero v4.0 TX macro in the Hawi platform.
It introduces v4.0 specific register defaults, extends regmap accessors, and
registers a separate decimator widget table to handle the new mux enum and
DAPM events.

> diff --git a/sound/soc/codecs/lpass-tx-macro.c b/sound/soc/codecs/lpass-tx-macro.c
> index 6deaaabe43afa..6480a6c9032e3 100644
> --- a/sound/soc/codecs/lpass-tx-macro.c
> +++ b/sound/soc/codecs/lpass-tx-macro.c
[ ... ]
> @@ -929,6 +998,10 @@ static int tx_macro_enable_dec(struct snd_soc_dapm_widget *w,
>  
>  	switch (event) {
>  	case SND_SOC_DAPM_PRE_PMU:
> +		/* Disable the ADPT block before enabling the decimator */
> +		if (tx->data->has_adpt)
> +			snd_soc_component_write_field(component, CDC_ADPT0_ADPT_CTRL,
> +						      CDC_TX_ADPT_CTRL_EN_MASK, 0x0);
>  		adc_mux_reg = CDC_TX_INP_MUX_ADC_MUXn_CFG1(decimator);
>  		if (snd_soc_component_read(component, adc_mux_reg) & SWR_MIC) {

[Severity: Medium]
Will this bitwise check incorrectly match the newly added RX_SWR_MIC?

The adc_mux_text_v9_3 enum added below introduces RX_SWR_MIC at index 3. When
RX_SWR_MIC is selected, snd_soc_component_read() & SWR_MIC evaluates to
3 & 1 == 1 (true).

This erroneously triggers SWR_MIC-specific logic for RX_SWR_MIC in both
tx_macro_enable_dec() and is_amic_enabled(). If a machine driver routes
RX_SWR_MIC and powers it up, the PRE_PMU block will read the irrelevant SMIC
mux register and overwrite CDC_TX_TOP_CSR_SWR_DMICn_CTL if the leftover value
is >= 5.

Even if not routed, the teardown bug in PRE_PMD executes when userspace
switches the mux away from an active path to RX_SWR_MIC.

[ ... ]
> @@ -2027,6 +2103,418 @@ static const struct snd_soc_dapm_route tx_audio_map_v9_2[] = {
>  	{"TX SMIC MUX7", "SWR_MIC11", "TX SWR_INPUT11"},
>  };
>  
> +static const char * const adc_mux_text_v9_3[] = {
> +	"MSM_DMIC", "SWR_MIC", "ANC_FB_TUNE1", "RX_SWR_MIC"
> +};

[ ... ]
> @@ -2250,6 +2751,9 @@ static int tx_macro_probe(struct platform_device *pdev)
>  	struct device_node *np = dev->of_node;
>  	struct tx_macro *tx;
>  	void __iomem *base;
> +	struct reg_default *reg_defaults __free(kfree) = NULL;
> +	struct regmap_config *reg_config __free(kfree) = NULL;
> +	size_t def_count;
>  	int ret, reg;

[ ... ]
> @@ -2304,7 +2808,40 @@ static int tx_macro_probe(struct platform_device *pdev)
>  		}
>  	}
>  
> -	tx->regmap = devm_regmap_init_mmio(dev, base, &tx_regmap_config);
> +	reg_config = kmemdup(&tx_regmap_config, sizeof(*reg_config), GFP_KERNEL);
> +	if (!reg_config) {
> +		ret = -ENOMEM;
> +		goto err;
> +	}

[Severity: Medium]
Is it safe to mix goto-based error handling with scope-based cleanup in this
function?

The new reg_defaults and reg_config pointers are declared with the
__free(kfree) attribute for automatic scope-based cleanup. However,
tx_macro_probe() handles errors unconditionally by jumping to the err or
err_rpm_put labels via goto statements.

The global Linux kernel cleanup guidelines explicitly forbid mixing goto-based
error paths with __free() cleanup blocks in the same function. Doing so causes
confusing ownership semantics and can lead to bugs where the compiler emits
cleanup instructions at label destinations that interfere with the expected
control flow. The subsystem rules require converting all resources to
scope-based cleanup or converting none of them.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261014-add_shikra_support_v5-v5-0-fb9f0667e613@oss.qualcomm.com?part=8

  reply	other threads:[~2026-10-14  9:35 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-14  9:12 [PATCH v5 0/9] ASoC: qcom: Add shikra and Hawi LPASS macro support Mohammad Rafi Shaik
2026-10-14  9:12 ` [PATCH v5 1/9] ASoC: dt-bindings: qcom: Add Shikra RX and VA macro codecs Mohammad Rafi Shaik
2026-10-14  9:12 ` [PATCH v5 2/9] ASoC: qcom: lpass-macro-common: Add missing v2.9 version string Mohammad Rafi Shaik
2026-10-14  9:12 ` [PATCH v5 3/9] ASoC: qcom: lpass-rx-macro: Add shikra compatible Mohammad Rafi Shaik
2026-10-14  9:28   ` sashiko-bot
2026-10-14  9:12 ` [PATCH v5 4/9] ASoC: qcom: lpass-va-macro: " Mohammad Rafi Shaik
2026-10-14  9:12 ` [PATCH v5 5/9] ASoC: qcom: lpass-va-macro: Add SoundWire microphone support Mohammad Rafi Shaik
2026-10-14  9:30   ` sashiko-bot
2026-10-14  9:12 ` [PATCH v5 6/9] ASoC: dt-bindings: qcom: Add Hawi LPASS macro codecs Mohammad Rafi Shaik
2026-10-14  9:35   ` sashiko-bot
2026-10-14  9:12 ` [PATCH v5 7/9] ASoC: dt-bindings: qcom: Add Maili " Mohammad Rafi Shaik
2026-10-14  9:12 ` [PATCH v5 8/9] ASoC: qcom: lpass-tx-macro: Add support for Bolero v4.0 Mohammad Rafi Shaik
2026-10-14  9:35   ` sashiko-bot [this message]
2026-10-14  9:12 ` [PATCH v5 9/9] ASoC: qcom: lpass: Add support for LPASS codec v4.0 Mohammad Rafi Shaik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sashiko-outbox-171080@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=mohammad.rafi.shaik@oss.qualcomm.com \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.