[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20241028-phy-tegra-xusb-tegra210-put_device-v1-1-28f74368c9ba@gmail.com>
Date: Mon, 28 Oct 2024 23:33:58 +0100
From: Javier Carrasco <javier.carrasco.cruz@...il.com>
To: JC Kuo <jckuo@...dia.com>, Vinod Koul <vkoul@...nel.org>,
Kishon Vijay Abraham I <kishon@...nel.org>,
Thierry Reding <thierry.reding@...il.com>,
Jonathan Hunter <jonathanh@...dia.com>
Cc: Thierry Reding <treding@...dia.com>, linux-phy@...ts.infradead.org,
linux-tegra@...r.kernel.org, linux-kernel@...r.kernel.org,
Javier Carrasco <javier.carrasco.cruz@...il.com>, stable@...r.kernel.org
Subject: [PATCH 1/2] phy: tegra: xusb: fix device release in
tegra210_xusb_padctl_probe
A reference to a device acquired via of_find_device_by_node() needs
to be released when it is no longer required by decrementing its
refcount, which avoids leaking the resource.
Add the missing call to platform_device_put() as soon as 'pdev' is no
longer required.
Cc: stable@...r.kernel.org
Fixes: 2d1021487273 ("phy: tegra: xusb: Add wake/sleepwalk for Tegra210")
Signed-off-by: Javier Carrasco <javier.carrasco.cruz@...il.com>
---
drivers/phy/tegra/xusb-tegra210.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/phy/tegra/xusb-tegra210.c b/drivers/phy/tegra/xusb-tegra210.c
index ebc8a7e21a31..9c7fdd29b7c4 100644
--- a/drivers/phy/tegra/xusb-tegra210.c
+++ b/drivers/phy/tegra/xusb-tegra210.c
@@ -3169,13 +3169,17 @@ tegra210_xusb_padctl_probe(struct device *dev,
goto out;
}
- if (!platform_get_drvdata(pdev))
+ if (!platform_get_drvdata(pdev)) {
+ platform_device_put(pdev);
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");
+ platform_device_put(pdev);
+
out:
return &padctl->base;
}
--
2.43.0
Powered by blists - more mailing lists