Commit 03310a15 authored by Johan Hovold's avatar Johan Hovold Committed by Greg Kroah-Hartman

USB: ledtrig-usbport: fix of-node leak

This code looks up a USB device node from a given parent USB device but
never dropped its reference to the returned node.

As only the address of the node is used for a later matching, the
reference can be dropped immediately.

Note that this trigger implementation confuses the description of the
USB device connected to a port with the port itself (which does not have
a device-tree representation).

Fixes: 4f04c210 ("usb: core: read USB ports from DT in the usbport LED trigger driver")
Cc: Rafał Miłecki <rafal@milecki.pl>
Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 1a7e3948
...@@ -137,11 +137,17 @@ static bool usbport_trig_port_observed(struct usbport_trig_data *usbport_data, ...@@ -137,11 +137,17 @@ static bool usbport_trig_port_observed(struct usbport_trig_data *usbport_data,
if (!led_np) if (!led_np)
return false; return false;
/* Get node of port being added */ /*
* Get node of port being added
*
* FIXME: This is really the device node of the connected device
*/
port_np = usb_of_get_child_node(usb_dev->dev.of_node, port1); port_np = usb_of_get_child_node(usb_dev->dev.of_node, port1);
if (!port_np) if (!port_np)
return false; return false;
of_node_put(port_np);
/* Amount of trigger sources for this LED */ /* Amount of trigger sources for this LED */
count = of_count_phandle_with_args(led_np, "trigger-sources", count = of_count_phandle_with_args(led_np, "trigger-sources",
"#trigger-source-cells"); "#trigger-source-cells");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment