mirror of
git://git.yoctoproject.org/linux-yocto.git
synced 2025-10-22 23:13:01 +02:00
phy: tegra: xusb: fix device and OF node leak at probe
commit bca065733afd1e3a89a02f05ffe14e966cd5f78e upstream.
Make sure to drop the references taken to the PMC OF node and device by
of_parse_phandle() and of_find_device_by_node() during probe.
Note the holding a reference to the PMC device does not prevent the
PMC regmap from going away (e.g. if the PMC driver is unbound) so there
is no need to keep the reference.
Fixes: 2d10214872
("phy: tegra: xusb: Add wake/sleepwalk for Tegra210")
Cc: stable@vger.kernel.org # 5.14
Cc: JC Kuo <jckuo@nvidia.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Link: https://lore.kernel.org/r/20250724131206.2211-2-johan@kernel.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
feb1f80228
commit
28cfc6ab15
|
@ -3164,18 +3164,22 @@ tegra210_xusb_padctl_probe(struct device *dev,
|
|||
}
|
||||
|
||||
pdev = of_find_device_by_node(np);
|
||||
of_node_put(np);
|
||||
if (!pdev) {
|
||||
dev_warn(dev, "PMC device is not available\n");
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (!platform_get_drvdata(pdev))
|
||||
if (!platform_get_drvdata(pdev)) {
|
||||
put_device(&pdev->dev);
|
||||
return ERR_PTR(-EPROBE_DEFER);
|
||||
}
|
||||
|
||||
padctl->regmap = dev_get_regmap(&pdev->dev, "usb_sleepwalk");
|
||||
if (!padctl->regmap)
|
||||
dev_info(dev, "failed to find PMC regmap\n");
|
||||
|
||||
put_device(&pdev->dev);
|
||||
out:
|
||||
return &padctl->base;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user