Skip to content

Commit 98244fc

Browse files
jhovoldgregkh
authored andcommitted
phy: ti-pipe3: fix device leak at unbind
commit e19bcea upstream. Make sure to drop the reference to the control device taken by of_find_device_by_node() during probe when the driver is unbound. Fixes: 918ee0d ("usb: phy: omap-usb3: Don't use omap_get_control_dev()") Cc: stable@vger.kernel.org # 3.13 Cc: Roger Quadros <rogerq@kernel.org> Signed-off-by: Johan Hovold <johan@kernel.org> Link: https://lore.kernel.org/r/20250724131206.2211-4-johan@kernel.org Signed-off-by: Vinod Koul <vkoul@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent e8e2002 commit 98244fc

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

drivers/phy/ti/phy-ti-pipe3.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -666,12 +666,20 @@ static int ti_pipe3_get_clk(struct ti_pipe3 *phy)
666666
return 0;
667667
}
668668

669+
static void ti_pipe3_put_device(void *_dev)
670+
{
671+
struct device *dev = _dev;
672+
673+
put_device(dev);
674+
}
675+
669676
static int ti_pipe3_get_sysctrl(struct ti_pipe3 *phy)
670677
{
671678
struct device *dev = phy->dev;
672679
struct device_node *node = dev->of_node;
673680
struct device_node *control_node;
674681
struct platform_device *control_pdev;
682+
int ret;
675683

676684
phy->phy_power_syscon = syscon_regmap_lookup_by_phandle(node,
677685
"syscon-phy-power");
@@ -703,6 +711,11 @@ static int ti_pipe3_get_sysctrl(struct ti_pipe3 *phy)
703711
}
704712

705713
phy->control_dev = &control_pdev->dev;
714+
715+
ret = devm_add_action_or_reset(dev, ti_pipe3_put_device,
716+
phy->control_dev);
717+
if (ret)
718+
return ret;
706719
}
707720

708721
if (phy->mode == PIPE3_MODE_PCIE) {

0 commit comments

Comments
 (0)