summaryrefslogtreecommitdiff
path: root/drivers/phy/phy-rockchip-usb.c
diff options
context:
space:
mode:
authorHeiko Stuebner <heiko@sntech.de>2015-11-20 00:22:22 +0300
committerKishon Vijay Abraham I <kishon@ti.com>2015-12-20 12:51:38 +0300
commit75d390fecf9e69eebca7f15de40d761e33fcfd7b (patch)
treea278c7c5eaf44b53ef52568b9ce01ab04df7e1bb /drivers/phy/phy-rockchip-usb.c
parent30e9a0b2147c8405109ad98ae670829dd92e4516 (diff)
downloadlinux-75d390fecf9e69eebca7f15de40d761e33fcfd7b.tar.xz
phy: rockchip-usb: fix clock get-put mismatch
Currently the phy driver only gets the optional clock reference but never puts it again, neither during error handling nor on remove. Fix that by moving the clk_put to a devm-action that gets called at the right time when all other devm actions are done. Signed-off-by: Heiko Stuebner <heiko@sntech.de> Reviewed-by: Douglas Anderson <dianders@chromium.org> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Diffstat (limited to 'drivers/phy/phy-rockchip-usb.c')
-rw-r--r--drivers/phy/phy-rockchip-usb.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/phy/phy-rockchip-usb.c b/drivers/phy/phy-rockchip-usb.c
index 62c43c435194..e941444072ba 100644
--- a/drivers/phy/phy-rockchip-usb.c
+++ b/drivers/phy/phy-rockchip-usb.c
@@ -90,6 +90,14 @@ static const struct phy_ops ops = {
.owner = THIS_MODULE,
};
+static void rockchip_usb_phy_action(void *data)
+{
+ struct rockchip_usb_phy *rk_phy = data;
+
+ if (rk_phy->clk)
+ clk_put(rk_phy->clk);
+}
+
static int rockchip_usb_phy_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
@@ -123,6 +131,10 @@ static int rockchip_usb_phy_probe(struct platform_device *pdev)
rk_phy->reg_offset = reg_offset;
rk_phy->reg_base = grf;
+ err = devm_add_action(dev, rockchip_usb_phy_action, rk_phy);
+ if (err)
+ return err;
+
rk_phy->clk = of_clk_get_by_name(child, "phyclk");
if (IS_ERR(rk_phy->clk))
rk_phy->clk = NULL;