Skip to content

Commit 9a52827

Browse files
jhovoldpH5
authored andcommitted
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: 487b1b3 ("reset: eyeq: add platform driver") Cc: Théo Lebrun <theo.lebrun@bootlin.com> Signed-off-by: Johan Hovold <johan@kernel.org> Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de> Link: https://lore.kernel.org/r/20250708085613.15823-1-johan@kernel.org Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
1 parent 8f5ae30 commit 9a52827

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

drivers/reset/reset-eyeq.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,13 @@ static int eqr_of_xlate_twocells(struct reset_controller_dev *rcdev,
410410
return eqr_of_xlate_internal(rcdev, reset_spec->args[0], reset_spec->args[1]);
411411
}
412412

413+
static void eqr_of_node_put(void *_dev)
414+
{
415+
struct device *dev = _dev;
416+
417+
of_node_put(dev->of_node);
418+
}
419+
413420
static int eqr_probe(struct auxiliary_device *adev,
414421
const struct auxiliary_device_id *id)
415422
{
@@ -428,6 +435,10 @@ static int eqr_probe(struct auxiliary_device *adev,
428435
if (!dev->of_node)
429436
return -ENODEV;
430437

438+
ret = devm_add_action_or_reset(dev, eqr_of_node_put, dev);
439+
if (ret)
440+
return ret;
441+
431442
/*
432443
* Using our newfound OF node, we can get match data. We cannot use
433444
* device_get_match_data() because it does not match reused OF nodes.

0 commit comments

Comments
 (0)