From: sashiko-bot@kernel.org
To: "Krzysztof Kozlowski" <krzysztof.kozlowski@oss.qualcomm.com>,
mfd@lists.linux.dev, imx@lists.linux.dev
Cc: Frank.Li@kernel.org, lee@kernel.org
Subject: Re: [PATCH 1/2] mfd: Constify mfd_cell arrays
Date: Fri, 30 Oct 2026 07:17:18 +0000 [thread overview]
Message-ID: <sashiko-outbox-190635@kernel.org> (raw)
In-Reply-To: <20261030071137.100954-3-krzysztof.kozlowski@oss.qualcomm.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] mfd: wm97xx-core: rodata write and const discard in wm97xx_ac97_probe()
--
commit d1e87419971e113856988eb45a5e61c55d61ecd6
Author: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
mfd: Constify mfd_cell arrays
This commit marks several struct mfd_cell arrays across drivers/mfd/ as
const so they can reside in read-only memory when passed to
mfd_add_devices().
> diff --git a/drivers/mfd/wm97xx-core.c b/drivers/mfd/wm97xx-core.c
> index 1566a9b04b6a0..c0ddcd5219b57 100644
> --- a/drivers/mfd/wm97xx-core.c
> +++ b/drivers/mfd/wm97xx-core.c
> @@ -104,7 +104,7 @@ static const struct regmap_config wm9705_regmap_config = {
> .writeable_reg = wm97xx_writeable_reg,
> };
>
> -static struct mfd_cell wm9705_cells[] = {
> +static const struct mfd_cell wm9705_cells[] = {
> { .name = "wm9705-codec", },
> { .name = "wm97xx-ts", },
> };
[Severity: High]
Can wm9705_cells be made const here?
In drivers/mfd/wm97xx-core.c, wm97xx_ac97_probe() declares cells as a
non-const pointer, assigns wm9705_cells to it when probing a
WM9705_VENDOR_ID device, and then mutates the array elements in place:
drivers/mfd/wm97xx-core.c:wm97xx_ac97_probe() {
...
struct mfd_cell *cells;
...
case WM9705_VENDOR_ID:
config = &wm9705_regmap_config;
cells = wm9705_cells;
nb_cells = ARRAY_SIZE(wm9705_cells);
break;
...
for (i = 0; i < nb_cells; i++) {
cells[i].platform_data = codec_pdata;
cells[i].pdata_size = sizeof(*codec_pdata);
}
}
Won't this discard the const qualifier at build time and fault when writing
to read-only memory during WM9705 device probe?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261030071137.100954-3-krzysztof.kozlowski@oss.qualcomm.com?part=1
next prev parent reply other threads:[~2026-10-30 7:17 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-30 7:11 [PATCH 1/2] mfd: Constify mfd_cell arrays Krzysztof Kozlowski
2026-10-30 7:11 ` [PATCH 2/2] mfd: cgbc: Allow compile testing Krzysztof Kozlowski
2026-10-30 9:49 ` Andy Shevchenko
2026-10-30 10:00 ` Thomas Richard (congatec GmbH)
2026-10-30 7:17 ` sashiko-bot [this message]
2026-10-30 7:33 ` [PATCH 1/2] mfd: Constify mfd_cell arrays Krzysztof Kozlowski
2026-10-30 8:24 ` Matti Vaittinen
2026-10-30 8:34 ` Chen-Yu Tsai
2026-10-30 8:47 ` Thomas Weißschuh
2026-10-30 14:02 ` Krzysztof Kozlowski
2026-10-30 9:23 ` Charles Keepax
2026-10-30 10:26 ` Thomas Richard (congatec GmbH)
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-190635@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=Frank.Li@kernel.org \
--cc=imx@lists.linux.dev \
--cc=krzysztof.kozlowski@oss.qualcomm.com \
--cc=lee@kernel.org \
--cc=mfd@lists.linux.dev \
--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.