From: sashiko-bot@kernel.org
To: "Mohammad Rafi Shaik" <mohammad.rafi.shaik@oss.qualcomm.com>
Cc: conor+dt@kernel.org, devicetree@vger.kernel.org, robh@kernel.org
Subject: Re: [PATCH v2 2/2] soundwire: qcom: add EE-aware register layout for Shikra
Date: Thu, 10 Sep 2026 06:34:01 +0000 [thread overview]
Message-ID: <20260910063402.1CBD11F00899@smtp.kernel.org> (raw)
In-Reply-To: <20260910-shikra_soundwire_support-v2-2-f98c9a6ea1e1@oss.qualcomm.com>
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
Pre-existing issues:
- [High] IRQ handler remains active after subsystem unregistration (Use-After-Free risk).
- [Medium] Missing clock cleanup on error path in probe.
- [Medium] Missing pm_runtime_disable() in remove.
--
commit ea7f212648855ca1f1b27ca9b52687d659dc81f7
Author: Mohammad Rafi Shaik <mohammad.rafi.shaik@oss.qualcomm.com>
soundwire: qcom: add EE-aware register layout for Shikra
On SoundWire v2.0 and later hardware, FIFO, and status
registers are banked per Execution Environment (EE).
The existing driver assumes the SoundWire controller is
assigned to EE1, which is true for all currently supported
Qualcomm SoCs.
Shikra is an exception and assigns the controller to EE0.
As a result, the relevant register windows are located at
different offsets and cannot be accessed using the default
EE1 register layout.
Add an ee field to the SoC match data and introduce a
dedicated qcom,shikra-soundwire compatible with ee = 0.
The driver uses this information at probe time to select
the correct register layout, while all existing platforms
continue to use the default EE1 configuration.
> diff --git a/drivers/soundwire/qcom.c b/drivers/soundwire/qcom.c
> index 35ffffd541bd1..6e0c5fb10efad 100644
> --- a/drivers/soundwire/qcom.c
> +++ b/drivers/soundwire/qcom.c
[ ... ]
> @@ -1659,6 +1711,7 @@ static int qcom_swrm_probe(struct platform_device *pdev)
> prop->default_row = data->default_rows;
>
> ctrl->reg_read(ctrl, SWRM_COMP_HW_VERSION, &ctrl->version);
> + qcom_swrm_set_ee_register_layout(ctrl, data);
>
> ret = devm_request_threaded_irq(dev, ctrl->irq, NULL,
> qcom_swrm_irq_handler,
[Severity: Medium]
This isn't a bug introduced by this patch, but looking at the error handling
further down in qcom_swrm_probe():
ctrl->wake_irq = of_irq_get(dev->of_node, 1);
if (ctrl->wake_irq > 0) {
ret = devm_request_threaded_irq(dev, ctrl->wake_irq, NULL,
qcom_swrm_wake_irq_handler,
IRQF_TRIGGER_HIGH | IRQF_ONESHOT,
"swr_wake_irq", ctrl);
if (ret) {
dev_err(dev, "Failed to request soundwire wake irq\n");
goto err_init;
}
}
If the devm_request_threaded_irq() for wake_irq fails, the code jumps directly
to the err_init label. Does this bypass the err_clk label, leaking the clock
reference and keeping it prepared and enabled unexpectedly?
[ ... ]
> @@ -1769,16 +1822,19 @@ static int __maybe_unused swrm_runtime_resume(struct device *dev)
> reset_control_reset(ctrl->audio_cgcr);
[Severity: High]
This is also a pre-existing issue, but I have a question about the teardown
sequence in qcom_swrm_remove() which sits just above this function:
static void qcom_swrm_remove(struct platform_device *pdev)
{
struct qcom_swrm_ctrl *ctrl = dev_get_drvdata(&pdev->dev);
sdw_bus_master_delete(&ctrl->bus);
clk_disable_unprepare(ctrl->hclk);
}
During driver unbind or module unload, this function tears down the bus and
slave devices. However, the driver uses a devm-managed IRQ handler which
remains active until devres release (after remove returns).
If a hardware interrupt fires during this window, could qcom_swrm_irq_handler()
execute and operate on the already destroyed bus and slave structures, leading
to a use-after-free or null pointer dereference?
[Severity: Medium]
This is another pre-existing issue in qcom_swrm_remove():
The qcom_swrm_probe() function sets up PM runtime:
pm_runtime_set_autosuspend_delay(dev, 3000);
pm_runtime_use_autosuspend(dev);
pm_runtime_mark_last_busy(dev);
pm_runtime_set_active(dev);
pm_runtime_enable(dev);
Should qcom_swrm_remove() call pm_runtime_disable() and related cleanup
functions like pm_runtime_dont_use_autosuspend() to balance this PM setup and
avoid leaving the device in an unbalanced state upon driver reload?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260910-shikra_soundwire_support-v2-0-f98c9a6ea1e1@oss.qualcomm.com?part=2
prev parent reply other threads:[~2026-09-10 6:34 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-10 6:20 [PATCH v2 0/2] soundwire: qcom: Add Shikra soundwire support Mohammad Rafi Shaik
2026-09-10 6:20 ` [PATCH v2 1/2] dt-bindings: soundwire: qcom: add qcom,shikra-soundwire compatible Mohammad Rafi Shaik
2026-09-11 8:36 ` Krzysztof Kozlowski
2026-09-10 6:20 ` [PATCH v2 2/2] soundwire: qcom: add EE-aware register layout for Shikra Mohammad Rafi Shaik
2026-09-10 6:34 ` sashiko-bot [this message]
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=20260910063402.1CBD11F00899@smtp.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox