Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 28cfc6a

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: [email protected] # 5.14 Cc: JC Kuo <[email protected]> Signed-off-by: Johan Hovold <[email protected]> Reviewed-by: Neil Armstrong <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Vinod Koul <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent feb1f80 commit 28cfc6a

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
@@ -3164,18 +3164,22 @@ tegra210_xusb_padctl_probe(struct device *dev,
31643164
}
31653165

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

3172-
if (!platform_get_drvdata(pdev))
3173+
if (!platform_get_drvdata(pdev)) {
3174+
put_device(&pdev->dev);
31733175
return ERR_PTR(-EPROBE_DEFER);
3176+
}
31743177

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

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

0 commit comments

Comments
 (0)