Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Richard Acayan" <mailingradian@gmail.com>
Cc: robh@kernel.org, conor+dt@kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH v6 13/15] ASoC: msm8916-wcd-analog: add pm8950 codec
Date: Thu, 30 Jul 2026 17:59:18 +0000	[thread overview]
Message-ID: <20260730175919.0CE5D1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260730174353.108023-14-mailingradian@gmail.com>

Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:

New issues:
- [High] Missing NULL pointer check for the return value of `of_device_get_match_data()` leads to a kernel panic if the driver is bound via a non-OF mechanism.

Pre-existing issues:
- [High] Interrupt handlers are requested and enabled before the component state they depend on is initialized, leading to a NULL pointer dereference if the interrupt fires early.
- [High] Component removal powers off regulators while threaded IRQ handlers are still active, leading to hardware accesses to a powered-off device.
--

--- Patch [13]: [PATCH v6 13/15] ASoC: msm8916-wcd-analog: add pm8950 codec ---
Note: The format of this review report is altered to provide a free-form summary of findings without directly quoting the original patch code due to recitation restrictions.

commit 16b89870656fc786971dbd432019e6b7585632a2
Author: Adam Skladowski <a39.skl@gmail.com>

ASoC: msm8916-wcd-analog: add pm8950 codec
    
Add regs overrides for PM8950 codec and implement matching reg overrides
via compatible.

In pm8916_wcd_analog_probe(), the code retrieves match data using
of_device_get_match_data() and assigns it to wcd_reg_init_data, which is
then immediately used in a loop condition.

[Severity: High]
Does this code handle cases where the driver might be bound via a non-OF
mechanism? If of_device_get_match_data() returns NULL, the immediate
dereference of wcd_reg_init_data->seq_size will cause a kernel panic. Could
a NULL pointer check be added before accessing the match data?

In pm8916_wcd_analog_spmi_probe(), threaded IRQs are requested using
devm_request_threaded_irq() and unmasked. The ASoC component state
priv->component is initialized later in pm8916_wcd_analog_probe().

[Severity: High]
This isn't a bug introduced by this patch, but can the interrupt handlers
execute before priv->component is properly initialized? If an interrupt fires
early during initialization, pm8916_mbhc_switch_irq_handler() will
dereference the uninitialized priv->component pointer, leading to a crash.
Should the interrupt registration be deferred, or the IRQs kept disabled
until the component probe completes?

In pm8916_wcd_analog_remove(), the regulators are disabled using
regulator_bulk_disable(). The threaded IRQ handlers are tied to the platform
device via devm_request_threaded_irq() and remain active.

[Severity: High]
This is a pre-existing issue, but does this function properly synchronize
or disable the associated threaded IRQ handlers before powering off the
regulators? If an interrupt fires right before the regulators are disabled,
the IRQ thread could wake up and attempt to access the hardware via
snd_soc_component_read() while the device is powered off, potentially
causing a bus timeout or crash. Should the IRQs be explicitly disabled
before turning off the regulators?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260730174353.108023-1-mailingradian@gmail.com?part=13

  reply	other threads:[~2026-07-30 17:59 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-30 17:43 [PATCH v6 00/15] SDM660 sound card and internal MI2S support Richard Acayan
2026-07-30 17:43 ` [PATCH v6 01/15] ASoC: dt-bindings: qcom,sm8250: add compatible for sdm660 Richard Acayan
2026-07-30 17:43 ` [PATCH v6 02/15] ASoC: dt-bindings: qcom: q6dsp: add support for lpi mi2s ports 5-6 Richard Acayan
2026-07-30 17:43 ` [PATCH v6 03/15] ASoC: dt-bindings: pm8916-wcd-analog-codec: Document pm8950/pm8953 Richard Acayan
2026-07-30 17:43 ` [PATCH v6 04/15] ASoC: dt-bindings: pm8916-analog-codec: Add PM660L compatible Richard Acayan
2026-07-30 17:43 ` [PATCH v6 05/15] ASoC: dt-bindings: msm8916-digital-codec: Add SDM660 compatible Richard Acayan
2026-07-30 17:43 ` [PATCH v6 06/15] ASoC: qdsp6: q6dsp-lpass-ports: add support for lpi mi2s ports 5-6 Richard Acayan
2026-07-30 18:15   ` sashiko-bot
2026-07-30 22:49   ` Srinivas Kandagatla
2026-07-30 17:43 ` [PATCH v6 07/15] ASoC: qdsp6: q6afe: add internal mi2s support Richard Acayan
2026-07-30 18:21   ` sashiko-bot
2026-07-30 22:51   ` Srinivas Kandagatla
2026-07-30 17:43 ` [PATCH v6 08/15] ASoC: qdsp6: q6afe-dai: " Richard Acayan
2026-07-30 18:06   ` sashiko-bot
2026-07-30 22:55   ` Srinivas Kandagatla
2026-07-30 17:43 ` [PATCH v6 09/15] ASoC: qdsp6: q6routing: add lpi " Richard Acayan
2026-07-30 22:57   ` Srinivas Kandagatla
2026-07-30 17:43 ` [PATCH v6 10/15] ASoC: qdsp6: common: support headphone jacks connected to lpi mi2s Richard Acayan
2026-07-30 17:43 ` [PATCH v6 11/15] ASoC: qcom: sm8250: add support for LPI_MI2S_RX_0 and LPI_MI2S_TX_3 Richard Acayan
2026-07-30 18:02   ` sashiko-bot
2026-07-30 17:43 ` [PATCH v6 12/15] ASoC: qcom: sm8250: add SDM660 compatible Richard Acayan
2026-07-30 17:43 ` [PATCH v6 13/15] ASoC: msm8916-wcd-analog: add pm8950 codec Richard Acayan
2026-07-30 17:59   ` sashiko-bot [this message]
2026-07-30 17:43 ` [PATCH v6 14/15] ASoC: msm8916-wcd-analog: add pm8953 codec Richard Acayan
2026-07-30 18:03   ` sashiko-bot
2026-07-30 17:43 ` [PATCH v6 15/15] ASoC: msm8916-wcd-analog: add quirk for cajon 2.0 Richard Acayan
2026-07-30 18:03   ` sashiko-bot

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=20260730175919.0CE5D1F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=mailingradian@gmail.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