From: sashiko-bot@kernel.org
To: "Christian Marangi" <ansuelsmth@gmail.com>
Cc: robh@kernel.org, conor+dt@kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH v3 3/4] ASoC: mediatek: common: permit to provide dedicated regmap for irq
Date: Thu, 28 May 2026 18:32:05 +0000 [thread overview]
Message-ID: <20260528183205.65E671F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260528174840.28644-4-ansuelsmth@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Architectural Anti-Pattern: Adding a dynamically allocated per-device pointer to a global static hardware description structure.
--
commit b0a6d4d7d0d69f71dca69402decc8e6c50ee4811
Author: Christian Marangi <ansuelsmth@gmail.com>
ASoC: mediatek: common: permit to provide dedicated regmap for irq
This commit adds an extra entry in the irq_data struct to allow using a
specific regmap if defined. If it is not defined, the global AFE regmap is
used as a fallback.
> diff --git a/sound/soc/mediatek/common/mtk-base-afe.h b/sound/soc/mediatek/common/mtk-base-afe.h
> --- a/sound/soc/mediatek/common/mtk-base-afe.h
> +++ b/sound/soc/mediatek/common/mtk-base-afe.h
[ ... ]
> @@ -87,6 +87,8 @@ struct mtk_base_irq_data {
> int irq_clr_reg;
> int irq_clr_shift;
> int irq_status_shift;
> +
> + struct regmap *regmap;
[Severity: High]
Does this change violate the Linux device model by adding a dynamically
allocated per-device pointer to a global static hardware description
structure?
If a devm-managed regmap is assigned to this global static array during
device probe, and the driver is unbound via sysfs, the devm framework will
free the regmap. This would leave a dangling pointer in the global irq_data
array.
Could this lead to a use-after-free if an interrupt handler directly accesses
this global array to retrieve the regmap during teardown, or if multiple
device instances exist?
Would it be safer to place the instance-specific regmap pointer in
struct mtk_base_afe_irq instead, which is properly dynamically allocated per
device instance during probe?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260528174840.28644-1-ansuelsmth@gmail.com?part=3
next prev parent reply other threads:[~2026-05-28 18:32 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-28 17:48 [PATCH v3 0/4] ASoC: Add support for Airoha AN7581 Christian Marangi
2026-05-28 17:48 ` [PATCH v3 1/4] ASoC: dt-bindings: Add Airoha AN7581 AFE Sound card Christian Marangi
2026-05-28 17:48 ` [PATCH v3 2/4] ASoC: dt-bindings: Add Airoha AN7581 AFE with WM8960 Codec schema Christian Marangi
2026-05-28 18:10 ` sashiko-bot
2026-05-28 17:48 ` [PATCH v3 3/4] ASoC: mediatek: common: permit to provide dedicated regmap for irq Christian Marangi
2026-05-28 18:32 ` sashiko-bot [this message]
2026-05-28 17:48 ` [PATCH v3 4/4] ASoC: airoha: Add AFE and machine driver for Airoha AN7581 Christian Marangi
2026-05-28 18:56 ` 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=20260528183205.65E671F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=ansuelsmth@gmail.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--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