phy: tegra: xusb: fix device and OF node leak at probe

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: 2d1021487273 ("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>

authored by Johan Hovold and committed by Vinod Koul bca06573 5cfdfc62

+5 -1
+5 -1
drivers/phy/tegra/xusb-tegra210.c
··· 3164 3164 } 3165 3165 3166 3166 pdev = of_find_device_by_node(np); 3167 + of_node_put(np); 3167 3168 if (!pdev) { 3168 3169 dev_warn(dev, "PMC device is not available\n"); 3169 3170 goto out; 3170 3171 } 3171 3172 3172 - if (!platform_get_drvdata(pdev)) 3173 + if (!platform_get_drvdata(pdev)) { 3174 + put_device(&pdev->dev); 3173 3175 return ERR_PTR(-EPROBE_DEFER); 3176 + } 3174 3177 3175 3178 padctl->regmap = dev_get_regmap(&pdev->dev, "usb_sleepwalk"); 3176 3179 if (!padctl->regmap) 3177 3180 dev_info(dev, "failed to find PMC regmap\n"); 3178 3181 3182 + put_device(&pdev->dev); 3179 3183 out: 3180 3184 return &padctl->base; 3181 3185 }