Skip to content

Commit a7c3d05

Browse files
jhovoldUlrich Hecht
authored andcommitted
phy: ti-pipe3: fix device leak at unbind
commit e19bcea99749ce8e8f1d359f68ae03210694ad56 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> Signed-off-by: Ulrich Hecht <uli@kernel.org>
1 parent e031ed4 commit a7c3d05

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -508,12 +508,20 @@ static int ti_pipe3_get_clk(struct ti_pipe3 *phy)
508508
return 0;
509509
}
510510

511+
static void ti_pipe3_put_device(void *_dev)
512+
{
513+
struct device *dev = _dev;
514+
515+
put_device(dev);
516+
}
517+
511518
static int ti_pipe3_get_sysctrl(struct ti_pipe3 *phy)
512519
{
513520
struct device *dev = phy->dev;
514521
struct device_node *node = dev->of_node;
515522
struct device_node *control_node;
516523
struct platform_device *control_pdev;
524+
int ret;
517525

518526
phy->phy_power_syscon = syscon_regmap_lookup_by_phandle(node,
519527
"syscon-phy-power");
@@ -544,6 +552,11 @@ static int ti_pipe3_get_sysctrl(struct ti_pipe3 *phy)
544552
}
545553

546554
phy->control_dev = &control_pdev->dev;
555+
556+
ret = devm_add_action_or_reset(dev, ti_pipe3_put_device,
557+
phy->control_dev);
558+
if (ret)
559+
return ret;
547560
}
548561

549562
if (of_device_is_compatible(node, "ti,phy-pipe3-pcie")) {

0 commit comments

Comments
 (0)