Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1342778
| From | Shawn Lin <shawn.lin@rock-chips.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH] phy: twl4030: add phy_remove_lookup while removing driver |
| Date | 2016-02-25 04:40 +0100 |
| Message-ID | <r5UWu-6hS-9@gated-at.bofh.it> (permalink) |
| Organization | linux.* mail to news gateway |
Driver should call phy_remove_lookup if it create lookup
for non-dt case, otherwise mem leak issue will happen when
removing driver.
Fixes: 61211b1b ("phy: twl4030: use the new lookup method")
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
---
drivers/phy/phy-twl4030-usb.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/phy/phy-twl4030-usb.c b/drivers/phy/phy-twl4030-usb.c
index 4a3fc6e..d3f905e 100644
--- a/drivers/phy/phy-twl4030-usb.c
+++ b/drivers/phy/phy-twl4030-usb.c
@@ -748,6 +748,8 @@ static int twl4030_usb_probe(struct platform_device *pdev)
static int twl4030_usb_remove(struct platform_device *pdev)
{
struct twl4030_usb *twl = platform_get_drvdata(pdev);
+ struct twl4030_usb_data *pdata = dev_get_platdata(&pdev->dev);
+ struct phy *phy;
int val;
pm_runtime_get_sync(twl->dev);
@@ -771,6 +773,14 @@ static int twl4030_usb_remove(struct platform_device *pdev)
/* disable complete OTG block */
twl4030_usb_clear_bits(twl, POWER_CTRL, POWER_CTRL_OTG_ENAB);
+ if (pdata) {
+ phy = phy_get(twl->dev, "usb");
+ if (!IS_ERR(phy)) {
+ phy_remove_lookup(phy, "usb", "musb-hdrc.0");
+ phy_put(phy);
+ }
+ }
+
if (cable_present(twl->linkstat))
pm_runtime_put_noidle(twl->dev);
pm_runtime_mark_last_busy(twl->dev);
--
2.3.7
Back to linux.kernel | Previous | Next | Find similar | Unroll thread
[PATCH] phy: twl4030: add phy_remove_lookup while removing driver Shawn Lin <shawn.lin@rock-chips.com> - 2016-02-25 04:40 +0100
csiph-web