[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1456371178-7403-1-git-send-email-shawn.lin@rock-chips.com>
Date: Thu, 25 Feb 2016 11:32:58 +0800
From: Shawn Lin <shawn.lin@...k-chips.com>
To: Kishon Vijay Abraham I <kishon@...com>
Cc: linux-kernel@...r.kernel.org, Shawn Lin <shawn.lin@...k-chips.com>
Subject: [PATCH] phy: twl4030: add phy_remove_lookup while removing driver
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@...k-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
Powered by blists - more mailing lists