Skip to contentSkip to conversation

reset: eyeq: fix OF node leak

PATCH In review Johan Hovold 2 participants 4 messages Jul 8, 2025 – Aug 27, 2025

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 reset: eyeq: fix OF node leak

Make sure to drop the OF node reference taken when probing the auxiliary device when the device is later unbound.

Fixes 487b1b32e317 ("reset: eyeq: add platform driver")
Cc Théo Lebrun <[email protected]>
---
 drivers/reset/reset-eyeq.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
drivers/reset/reset-eyeq.c +11 -0
index 02d50041048b..2d3998368a1c 100644
@@ -410,6 +410,13 @@ static int eqr_of_xlate_twocells(struct reset_controller_dev *rcdev,
 	return eqr_of_xlate_internal(rcdev, reset_spec->args[0], reset_spec->args[1]);
 }
 
+static void eqr_of_node_put(void *_dev)
+{
+	struct device *dev = _dev;
+
+	of_node_put(dev->of_node);
+}
+
 static int eqr_probe(struct auxiliary_device *adev,
 		     const struct auxiliary_device_id *id)
 {
@@ -428,6 +435,10 @@ static int eqr_probe(struct auxiliary_device *adev,
 	if (!dev->of_node)
 		return -ENODEV;
 
+	ret = devm_add_action_or_reset(dev, eqr_of_node_put, dev);
+	if (ret)
+		return ret;
+
 	/*
 	 * Using our newfound OF node, we can get match data. We cannot use
 	 * device_get_match_data() because it does not match reused OF nodes.
Signature · 1 line
2.49.0
#1 lore raw
Quoted 6 lines · Johan Hovold

Make sure to drop the OF node reference taken when probing the auxiliary device when the device is later unbound.

Fixes 487b1b32e317 ("reset: eyeq: add platform driver")
Cc Théo Lebrun <[email protected]>

Can this one be picked up?

Johan

maintainer
#2 lore raw
In reply to Johan Hovold
Quoted 9 lines · Johan Hovold
Quoted 6 lines · Johan Hovold

Make sure to drop the OF node reference taken when probing the auxiliary device when the device is later unbound.

Fixes 487b1b32e317 ("reset: eyeq: add platform driver")
Cc Théo Lebrun <[email protected]>

Can this one be picked up?

Thank you for the reminder, applied to reset/fixes.

[1/1] reset: eyeq: fix OF node leak

      https://git.pengutronix.de/cgit/pza/linux/commit/?id=9a52827a9bbb

regards
Philipp