From: Yige Jiang <yigejiang86@gmail.com>
To: Mark Brown <broonie@kernel.org>
Cc: Yige Jiang <yigejiang86@gmail.com>,
Liam Girdwood <lgirdwood@gmail.com>,
linux-kernel@vger.kernel.org,
Bartosz Golaszewski <brgl@kernel.org>,
WenTao Liang <vulab@iscas.ac.cn>
Subject: [PATCH v2] regulator: as3722: use the platform OF node setter
Date: Thu, 5 Nov 2026 18:03:41 +0800 [thread overview]
Message-ID: <20261105100342.34730-1-yigejiang86@gmail.com> (raw)
In-Reply-To: <brzyrqnyrayxdpnyginamtdewj6cp3odhndlstjp6kupnr4q3e@rt73ebxxvbms>
as3722_get_regulator_dt_data() gets the regulators child node and
assigns it only to dev.of_node. Platform device release now puts
dev.fwnode, leaving the acquired node reference unreleased.
Use platform_device_set_of_node() to synchronize both fields and
give the device its own reference. Use __free(device_node) to release
the local lookup reference when the function returns. This keeps
the node valid for regulator matching and the platform device
lifetime, while also replacing the previous device-owned reference
on a probe retry.
Fixes: 7b5b51b2b05c ("driver core: platform: count references to all kinds of firmware nodes")
Signed-off-by: Yige Jiang <yigejiang86@gmail.com>
---
Changes in v2:
- Use __free(device_node) for the local lookup reference, as suggested
by Bartosz Golaszewski, instead of an explicit of_node_put().
- Remove the Assisted-by trailer; keep the disclosure below.
Based on linux-next next-20261102 (2637bdec0535).
Compile-tested: arm64, GCC 14.2.0, W=1, CONFIG_OF_DYNAMIC=y.
COMPILE_TEST=y.
Baseline and v2 target objects built from this exact base.
No full kernel/module-link, hardware or runtime test was performed.
AI assistance was used for analysis and patch preparation.
The earlier dangling-node fix is already present in this base.
drivers/regulator/as3722-regulator.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/regulator/as3722-regulator.c b/drivers/regulator/as3722-regulator.c
index 85e2aaa1a06b..ffcefd72316a 100644
--- a/drivers/regulator/as3722-regulator.c
+++ b/drivers/regulator/as3722-regulator.c
@@ -585,18 +585,18 @@
static int as3722_get_regulator_dt_data(struct platform_device *pdev,
struct as3722_regulators *as3722_regs)
{
- struct device_node *np;
struct as3722_regulator_config_data *reg_config;
u32 prop;
int id;
int ret;
- np = of_get_child_by_name(pdev->dev.parent->of_node, "regulators");
+ struct device_node *np __free(device_node) =
+ of_get_child_by_name(pdev->dev.parent->of_node, "regulators");
if (!np) {
dev_err(&pdev->dev, "Device is not having regulators node\n");
return -ENODEV;
}
- pdev->dev.of_node = np;
+ platform_device_set_of_node(pdev, np);
ret = of_regulator_match(&pdev->dev, np, as3722_regulator_matches,
ARRAY_SIZE(as3722_regulator_matches));
base-commit: 2637bdec0535a2044cd830eba9a79363651d9043
next prev parent reply other threads:[~2026-11-05 10:03 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-04 18:09 [PATCH] " Yige Jiang
2026-11-05 9:00 ` Bartosz Golaszewski
2026-11-05 10:03 ` Yige Jiang [this message]
2026-11-05 11:20 ` [PATCH v2] " Mark Brown
2026-11-05 14:04 ` Bartosz Golaszewski
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=20261105100342.34730-1-yigejiang86@gmail.com \
--to=yigejiang86@gmail.com \
--cc=brgl@kernel.org \
--cc=broonie@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=vulab@iscas.ac.cn \
/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
all inboxes | Powered by JetHome®