Skip to content

Commit e8e2002

Browse files
jhovoldgregkh
authored andcommitted
phy: tegra: xusb: fix device and OF node leak at probe
commit bca0657 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: 2d10214 ("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>
1 parent d9c8ad9 commit e8e2002

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

drivers/phy/tegra/xusb-tegra210.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3165,18 +3165,22 @@ tegra210_xusb_padctl_probe(struct device *dev,
31653165
}
31663166

31673167
pdev = of_find_device_by_node(np);
3168+
of_node_put(np);
31683169
if (!pdev) {
31693170
dev_warn(dev, "PMC device is not available\n");
31703171
goto out;
31713172
}
31723173

3173-
if (!platform_get_drvdata(pdev))
3174+
if (!platform_get_drvdata(pdev)) {
3175+
put_device(&pdev->dev);
31743176
return ERR_PTR(-EPROBE_DEFER);
3177+
}
31753178

31763179
padctl->regmap = dev_get_regmap(&pdev->dev, "usb_sleepwalk");
31773180
if (!padctl->regmap)
31783181
dev_info(dev, "failed to find PMC regmap\n");
31793182

3183+
put_device(&pdev->dev);
31803184
out:
31813185
return &padctl->base;
31823186
}

0 commit comments

Comments
 (0)