]> www.infradead.org Git - users/jedix/linux-maple.git/commit
usb: core: add missing of_node_put() in usb_of_has_devices_or_graph
authorJavier Carrasco <javier.carrasco.cruz@gmail.com>
Mon, 24 Jun 2024 21:10:06 +0000 (23:10 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 3 Jul 2024 14:04:10 +0000 (16:04 +0200)
commitc7a5403ea04320e08f2595baa940541a59a3856e
treed735145089426b3c6645fc084711aba253d80aee
parent3859e85de30815a20bce7db712ce3d94d40a682d
usb: core: add missing of_node_put() in usb_of_has_devices_or_graph

The for_each_child_of_node() macro requires an explicit call to
of_node_put() on early exits to decrement the child refcount and avoid a
memory leak.
The child node is not required outsie the loop, and the resource must be
released before the function returns.

Add the missing of_node_put().

Cc: stable@vger.kernel.org
Fixes: 82e82130a78b ("usb: core: Set connect_type of ports based on DT node")
Signed-off-by: Javier Carrasco <javier.carrasco.cruz@gmail.com>
Reviewed-by: Stephen Boyd <swboyd@chromium.org>
Link: https://lore.kernel.org/r/20240624-usb_core_of_memleak-v1-1-af6821c1a584@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/core/of.c