Commit 0b52edae authored by Johan Hovold's avatar Johan Hovold Committed by Greg Kroah-Hartman
Browse files

slimbus: core: fix OF node leak on registration failure



Make sure to drop the OF node reference taken when initialising and
registering the slimbus device also on registration failure by releasing
it in the destructor as expected.

Fixes: 7588a511 ("slimbus: core: add support to device tree helper")
Fixes: 01360857 ("slimbus: core: Fix mismatch in of_node_get/put")
Cc: Saravana Kannan <saravanak@google.com>
Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
Link: https://patch.msgid.link/20251126145329.5022-2-johan@kernel.org


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent aa3f64a9
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -146,6 +146,7 @@ static void slim_dev_release(struct device *dev)
{
	struct slim_device *sbdev = to_slim_device(dev);

	of_node_put(sbdev->dev.of_node);
	kfree(sbdev);
}

@@ -280,7 +281,6 @@ EXPORT_SYMBOL_GPL(slim_register_controller);
/* slim_remove_device: Remove the effect of slim_add_device() */
static void slim_remove_device(struct slim_device *sbdev)
{
	of_node_put(sbdev->dev.of_node);
	device_unregister(&sbdev->dev);
}