OSDN Git Service

USB: phy: am335x-control: fix device and of_node leaks
authorJohan Hovold <johan@kernel.org>
Tue, 1 Nov 2016 10:40:25 +0000 (11:40 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 12 Jan 2017 10:39:20 +0000 (11:39 +0100)
commit93f6891a383f92f88793da1e46cb018bdef8c18a
treee7da4acf98fd337d7e12930f2ef1818f0a010ea2
parentd387f98cb0c1e70ad45daacfb96acec4a5e0cb60
USB: phy: am335x-control: fix device and of_node leaks

commit 015105b12183556771e111e93f5266851e7c5582 upstream.

Make sure to drop the references taken by of_parse_phandle() and
bus_find_device() before returning from am335x_get_phy_control().

Note that there is no guarantee that the devres-managed struct
phy_control will be valid for the lifetime of the sibling phy device
regardless of this change.

Fixes: 3bb869c8b3f1 ("usb: phy: Add AM335x PHY driver")
Acked-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/phy/phy-am335x-control.c