From: sashiko-bot@kernel.org
To: "Uwe Kleine-König (The Capable Hub)" <u.kleine-koenig@baylibre.com>
Cc: linux-sunxi@lists.linux.dev, lee@kernel.org, mfd@lists.linux.dev,
imx@lists.linux.dev, Frank.Li@kernel.org,
neil.armstrong@linaro.org, wsa+renesas@sang-engineering.com,
linux-amlogic@lists.infradead.org
Subject: Re: [PATCH v3 21/23] mfd: Unify style of of_device_id arrays
Date: Thu, 09 Jul 2026 17:19:22 +0000 [thread overview]
Message-ID: <20260709171923.325291F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <e5cc82aa51da5f545f745b126923fdd6085a68a0.1783615311.git.u.kleine-koenig@baylibre.com>
Thank you for your contribution! Sashiko AI review found 4 potential issue(s) to consider:
Pre-existing issues:
- [High] Complex platform data and child device structures passed via match data
- [High] Dynamic modification of global mfd_cell arrays introduces data races
- [High] Data race on global da9063_regmap_config struct during probe
- [High] IRQ handler leak and subsequent Use-After-Free in twl6030_exit_irq
--
--- Patch [21]: [PATCH v3 21/23] mfd: Unify style of of_device_id arrays ---
commit 99f4911da67f8c43f41d211ea0ad4e7a3a4972cd
Author: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
mfd: Unify style of of_device_id arrays
This commit unifies the coding style of of_device_id arrays across multiple
MFD drivers. It removes trailing commas after list terminators, adds spaces
before closing braces, and ensures consistent formatting.
> diff --git a/drivers/mfd/da9063-i2c.c b/drivers/mfd/da9063-i2c.c
> --- a/drivers/mfd/da9063-i2c.c
> +++ b/drivers/mfd/da9063-i2c.c
[ ... ]
> @@ -361,11 +361,12 @@ static struct regmap_config da9063_regmap_config = {
> };
>
> static const struct of_device_id da9063_dt_ids[] = {
> - { .compatible = "dlg,da9063", },
> - { .compatible = "dlg,da9063l", },
> + { .compatible = "dlg,da9063" },
> + { .compatible = "dlg,da9063l" },
> { }
> };
> MODULE_DEVICE_TABLE(of, da9063_dt_ids);
> +
> static int da9063_i2c_probe(struct i2c_client *i2c)
> {
> const struct i2c_device_id *id = i2c_client_get_device_id(i2c);
[Severity: High]
This is a pre-existing issue, but does da9063_i2c_probe() mutate the shared
global da9063_regmap_config struct during probe?
Depending on the device variant, the probe function dynamically assigns
different tables:
da9063_regmap_config.rd_table = &da9063_ad_readable_table;
Could this lead to a data race causing incorrect configuration if multiple
instances of the device (or different variants) are probed at the same time?
> diff --git a/drivers/mfd/rohm-bd9576.c b/drivers/mfd/rohm-bd9576.c
> --- a/drivers/mfd/rohm-bd9576.c
> +++ b/drivers/mfd/rohm-bd9576.c
[ ... ]
> @@ -167,9 +167,9 @@ static int bd957x_i2c_probe(struct i2c_client *i2c)
> }
>
> static const struct of_device_id bd957x_of_match[] = {
> - { .compatible = "rohm,bd9576", .data = (void *)ROHM_CHIP_TYPE_BD9576, },
> - { .compatible = "rohm,bd9573", .data = (void *)ROHM_CHIP_TYPE_BD9573, },
> - { },
> + { .compatible = "rohm,bd9576", .data = (void *)ROHM_CHIP_TYPE_BD9576 },
> + { .compatible = "rohm,bd9573", .data = (void *)ROHM_CHIP_TYPE_BD9573 },
> + { }
> };
[Severity: High]
This isn't a bug introduced by this patch, but does the probe function for
this device dynamically modify a shared global mfd_cell array?
bd957x_i2c_probe() contains:
regulators = &bd9576_mfd_cells[BD957X_REGULATOR_CELL];
regulators->resources = bd9576_regulator_irqs;
If multiple instances of this device are probed concurrently, could they race
to modify the same global array? A similar issue also seems to exist in
88pm860x-core.c and as3711.c.
> diff --git a/drivers/mfd/simple-mfd-i2c.c b/drivers/mfd/simple-mfd-i2c.c
> --- a/drivers/mfd/simple-mfd-i2c.c
> +++ b/drivers/mfd/simple-mfd-i2c.c
[ ... ]
> @@ -126,7 +126,7 @@ static const struct of_device_id simple_mfd_i2c_of_match[] = {
> { .compatible = "maxim,max77705-battery", .data = &maxim_mon_max77705 },
> { .compatible = "silergy,sy7636a", .data = &silergy_sy7636a },
> { .compatible = "spacemit,p1", .data = &spacemit_p1 },
> - {}
> + { }
> };
[Severity: High]
This is a pre-existing issue, but does passing complex struct pointers
through the match data violate the MFD subsystem guidelines? The
documentation recommends using an integer or enum ID instead to avoid memory
safety hazards and initialization ordering races.
This pattern appears here as well as in mc13xxx-spi.c, rk8xx-i2c.c,
sec-acpm.c, sec-i2c.c, and sun6i-prcm.c.
> diff --git a/drivers/mfd/twl6030-irq.c b/drivers/mfd/twl6030-irq.c
> --- a/drivers/mfd/twl6030-irq.c
> +++ b/drivers/mfd/twl6030-irq.c
[ ... ]
> @@ -285,7 +285,7 @@ static const struct irq_domain_ops twl6030_irq_domain_ops = {
> static const struct of_device_id twl6030_of_match[] __maybe_unused = {
> { .compatible = "ti,twl6030", .data = &twl6030_interrupt_mapping },
> { .compatible = "ti,twl6032", .data = &twl6032_interrupt_mapping },
> - { },
> + { }
> };
>
> int twl6030_init_irq(struct device *dev, int irq_num)
[Severity: High]
This is a pre-existing issue, but is there an IRQ handler leak and potential
use-after-free during device removal here?
In twl6030_init_irq(), the interrupt is requested with twl6030_irq as the
dev_id:
status = request_threaded_irq(irq_num, NULL, twl6030_irq_thread,
IRQF_ONESHOT, "TWL6030-PIH", twl6030_irq);
However, in twl6030_exit_irq(), it appears NULL is passed to free_irq()
instead of twl6030_irq:
free_irq(twl6030_irq->twl_irq, NULL);
Will free_irq() silently fail to remove the handler due to the mismatched
dev_id, leaving the handler registered after the twl6030_irq struct is freed?
--
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1783615311.git.u.kleine-koenig@baylibre.com?part=21
_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic
WARNING: multiple messages have this Message-ID (diff)
From: sashiko-bot@kernel.org
To: "Uwe Kleine-König (The Capable Hub)" <u.kleine-koenig@baylibre.com>
Cc: linux-sunxi@lists.linux.dev, lee@kernel.org, mfd@lists.linux.dev,
imx@lists.linux.dev, Frank.Li@kernel.org,
neil.armstrong@linaro.org, wsa+renesas@sang-engineering.com,
linux-amlogic@lists.infradead.org
Subject: Re: [PATCH v3 21/23] mfd: Unify style of of_device_id arrays
Date: Thu, 09 Jul 2026 17:19:22 +0000 [thread overview]
Message-ID: <20260709171923.325291F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <e5cc82aa51da5f545f745b126923fdd6085a68a0.1783615311.git.u.kleine-koenig@baylibre.com>
Thank you for your contribution! Sashiko AI review found 4 potential issue(s) to consider:
Pre-existing issues:
- [High] Complex platform data and child device structures passed via match data
- [High] Dynamic modification of global mfd_cell arrays introduces data races
- [High] Data race on global da9063_regmap_config struct during probe
- [High] IRQ handler leak and subsequent Use-After-Free in twl6030_exit_irq
--
--- Patch [21]: [PATCH v3 21/23] mfd: Unify style of of_device_id arrays ---
commit 99f4911da67f8c43f41d211ea0ad4e7a3a4972cd
Author: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
mfd: Unify style of of_device_id arrays
This commit unifies the coding style of of_device_id arrays across multiple
MFD drivers. It removes trailing commas after list terminators, adds spaces
before closing braces, and ensures consistent formatting.
> diff --git a/drivers/mfd/da9063-i2c.c b/drivers/mfd/da9063-i2c.c
> --- a/drivers/mfd/da9063-i2c.c
> +++ b/drivers/mfd/da9063-i2c.c
[ ... ]
> @@ -361,11 +361,12 @@ static struct regmap_config da9063_regmap_config = {
> };
>
> static const struct of_device_id da9063_dt_ids[] = {
> - { .compatible = "dlg,da9063", },
> - { .compatible = "dlg,da9063l", },
> + { .compatible = "dlg,da9063" },
> + { .compatible = "dlg,da9063l" },
> { }
> };
> MODULE_DEVICE_TABLE(of, da9063_dt_ids);
> +
> static int da9063_i2c_probe(struct i2c_client *i2c)
> {
> const struct i2c_device_id *id = i2c_client_get_device_id(i2c);
[Severity: High]
This is a pre-existing issue, but does da9063_i2c_probe() mutate the shared
global da9063_regmap_config struct during probe?
Depending on the device variant, the probe function dynamically assigns
different tables:
da9063_regmap_config.rd_table = &da9063_ad_readable_table;
Could this lead to a data race causing incorrect configuration if multiple
instances of the device (or different variants) are probed at the same time?
> diff --git a/drivers/mfd/rohm-bd9576.c b/drivers/mfd/rohm-bd9576.c
> --- a/drivers/mfd/rohm-bd9576.c
> +++ b/drivers/mfd/rohm-bd9576.c
[ ... ]
> @@ -167,9 +167,9 @@ static int bd957x_i2c_probe(struct i2c_client *i2c)
> }
>
> static const struct of_device_id bd957x_of_match[] = {
> - { .compatible = "rohm,bd9576", .data = (void *)ROHM_CHIP_TYPE_BD9576, },
> - { .compatible = "rohm,bd9573", .data = (void *)ROHM_CHIP_TYPE_BD9573, },
> - { },
> + { .compatible = "rohm,bd9576", .data = (void *)ROHM_CHIP_TYPE_BD9576 },
> + { .compatible = "rohm,bd9573", .data = (void *)ROHM_CHIP_TYPE_BD9573 },
> + { }
> };
[Severity: High]
This isn't a bug introduced by this patch, but does the probe function for
this device dynamically modify a shared global mfd_cell array?
bd957x_i2c_probe() contains:
regulators = &bd9576_mfd_cells[BD957X_REGULATOR_CELL];
regulators->resources = bd9576_regulator_irqs;
If multiple instances of this device are probed concurrently, could they race
to modify the same global array? A similar issue also seems to exist in
88pm860x-core.c and as3711.c.
> diff --git a/drivers/mfd/simple-mfd-i2c.c b/drivers/mfd/simple-mfd-i2c.c
> --- a/drivers/mfd/simple-mfd-i2c.c
> +++ b/drivers/mfd/simple-mfd-i2c.c
[ ... ]
> @@ -126,7 +126,7 @@ static const struct of_device_id simple_mfd_i2c_of_match[] = {
> { .compatible = "maxim,max77705-battery", .data = &maxim_mon_max77705 },
> { .compatible = "silergy,sy7636a", .data = &silergy_sy7636a },
> { .compatible = "spacemit,p1", .data = &spacemit_p1 },
> - {}
> + { }
> };
[Severity: High]
This is a pre-existing issue, but does passing complex struct pointers
through the match data violate the MFD subsystem guidelines? The
documentation recommends using an integer or enum ID instead to avoid memory
safety hazards and initialization ordering races.
This pattern appears here as well as in mc13xxx-spi.c, rk8xx-i2c.c,
sec-acpm.c, sec-i2c.c, and sun6i-prcm.c.
> diff --git a/drivers/mfd/twl6030-irq.c b/drivers/mfd/twl6030-irq.c
> --- a/drivers/mfd/twl6030-irq.c
> +++ b/drivers/mfd/twl6030-irq.c
[ ... ]
> @@ -285,7 +285,7 @@ static const struct irq_domain_ops twl6030_irq_domain_ops = {
> static const struct of_device_id twl6030_of_match[] __maybe_unused = {
> { .compatible = "ti,twl6030", .data = &twl6030_interrupt_mapping },
> { .compatible = "ti,twl6032", .data = &twl6032_interrupt_mapping },
> - { },
> + { }
> };
>
> int twl6030_init_irq(struct device *dev, int irq_num)
[Severity: High]
This is a pre-existing issue, but is there an IRQ handler leak and potential
use-after-free during device removal here?
In twl6030_init_irq(), the interrupt is requested with twl6030_irq as the
dev_id:
status = request_threaded_irq(irq_num, NULL, twl6030_irq_thread,
IRQF_ONESHOT, "TWL6030-PIH", twl6030_irq);
However, in twl6030_exit_irq(), it appears NULL is passed to free_irq()
instead of twl6030_irq:
free_irq(twl6030_irq->twl_irq, NULL);
Will free_irq() silently fail to remove the handler due to the mismatched
dev_id, leaving the handler registered after the twl6030_irq struct is freed?
--
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1783615311.git.u.kleine-koenig@baylibre.com?part=21
next prev parent reply other threads:[~2026-07-09 17:19 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-09 16:58 [PATCH v3 00/23] mfd: Use named initializers for arrays of *_device_data Uwe Kleine-König (The Capable Hub)
2026-07-09 16:58 ` Uwe Kleine-König (The Capable Hub)
2026-07-09 16:58 ` [PATCH v3 01/23] mfd: bcm2835-pm: Remove member of struct bcm2835_pm that is only used locally Uwe Kleine-König (The Capable Hub)
2026-07-09 16:58 ` [PATCH v3 02/23] mfd: bcm2835-pm: Drop unused header Uwe Kleine-König (The Capable Hub)
2026-07-09 16:58 ` [PATCH v3 03/23] mfd: kempld: Simplify device abstraction Uwe Kleine-König (The Capable Hub)
2026-07-09 16:58 ` [PATCH v3 04/23] mfd: lp87565: Explicitly set driver data for the generic dt compatible Uwe Kleine-König (The Capable Hub)
2026-07-09 16:58 ` [PATCH v3 05/23] mfd: mt6360: Drop irrelevant __maybe_unused Uwe Kleine-König (The Capable Hub)
2026-07-09 16:58 ` [PATCH v3 06/23] mfd: rt4831: " Uwe Kleine-König (The Capable Hub)
2026-07-09 16:58 ` [PATCH v3 07/23] mfd: loongson-se: Drop unused assignment of acpi_device_id driver data Uwe Kleine-König (The Capable Hub)
2026-07-09 16:58 ` [PATCH v3 08/23] mfd: Drop unused assignment of i2c_device_id " Uwe Kleine-König (The Capable Hub)
2026-07-09 16:58 ` [PATCH v3 09/23] mfd: Drop unused assignment of platform_device_id " Uwe Kleine-König (The Capable Hub)
2026-07-09 16:58 ` [PATCH v3 10/23] mfd: Drop unused assignment of spi_device_id " Uwe Kleine-König (The Capable Hub)
2026-07-09 16:58 ` [PATCH v3 11/23] mfd: Use named initializers for acpi_device_id arrays Uwe Kleine-König (The Capable Hub)
2026-07-09 16:58 ` [PATCH v3 12/23] mfd: intel-m10-bmc-pmci: Use named initializers for dfl_device_id array Uwe Kleine-König (The Capable Hub)
2026-07-09 16:58 ` [PATCH v3 13/23] mfd: Use named initializers for arrays of i2c_device_id Uwe Kleine-König (The Capable Hub)
2026-07-09 17:14 ` sashiko-bot
2026-07-09 16:58 ` [PATCH v3 14/23] mfd: twl6030: Use named initializers for of_device_id Uwe Kleine-König (The Capable Hub)
2026-07-09 16:58 ` [PATCH v3 15/23] mfd: Use PCI_DEVICE* macros to initialize pci_device_id arrays Uwe Kleine-König (The Capable Hub)
2026-07-09 16:58 ` [PATCH v3 16/23] mfd: Use named initializers for platform_device_id array Uwe Kleine-König (The Capable Hub)
2026-07-09 16:58 ` [PATCH v3 17/23] mfd: Use named initializers for arrays of spi_device_id Uwe Kleine-König (The Capable Hub)
2026-07-09 16:58 ` [PATCH v3 18/23] mfd: Unify style of acpi_device_id arrays Uwe Kleine-König (The Capable Hub)
2026-07-09 16:58 ` [PATCH v3 19/23] mfd: Unify style of dmi_system_id arrays Uwe Kleine-König (The Capable Hub)
2026-07-09 16:58 ` [PATCH v3 20/23] mfd: Unify style of i2c_device_id arrays Uwe Kleine-König (The Capable Hub)
2026-07-09 16:58 ` [PATCH v3 21/23] mfd: Unify style of of_device_id arrays Uwe Kleine-König (The Capable Hub)
2026-07-09 16:58 ` Uwe Kleine-König (The Capable Hub)
2026-07-09 17:19 ` sashiko-bot [this message]
2026-07-09 17:19 ` sashiko-bot
2026-07-10 10:21 ` Geert Uytterhoeven
2026-07-10 10:21 ` Geert Uytterhoeven
2026-07-10 13:00 ` Mathieu Dubois-Briand
2026-07-10 13:00 ` Mathieu Dubois-Briand
2026-07-10 13:15 ` Krzysztof Kozlowski
2026-07-10 13:15 ` Krzysztof Kozlowski
2026-07-10 16:54 ` Charles Keepax
2026-07-10 16:54 ` Charles Keepax
2026-07-09 16:58 ` [PATCH v3 22/23] mfd: Unify style of pci_device_id arrays Uwe Kleine-König (The Capable Hub)
2026-07-09 16:58 ` [PATCH v3 23/23] mfd: Unify style of spi_device_id arrays Uwe Kleine-König (The Capable Hub)
2026-07-10 19:45 ` [PATCH v3 00/23] mfd: Use named initializers for arrays of *_device_data Linus Walleij
2026-07-10 19:45 ` Linus Walleij
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=20260709171923.325291F00A3A@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=Frank.Li@kernel.org \
--cc=imx@lists.linux.dev \
--cc=lee@kernel.org \
--cc=linux-amlogic@lists.infradead.org \
--cc=linux-sunxi@lists.linux.dev \
--cc=mfd@lists.linux.dev \
--cc=neil.armstrong@linaro.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=u.kleine-koenig@baylibre.com \
--cc=wsa+renesas@sang-engineering.com \
/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.