phy: rockchip-usb: fix clock get-put mismatch

A patch from »phy: rockchip-usb: correct pll handling and usb-uart« in state Mainline for linux-kernel

From: Heiko Stuebner <heiko@...> Date: Tue, 3 Nov 2015 14:14:23 +0100

Commit-Message

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@...> Reviewed-by: Douglas Anderson <dianders@...>

Patch-Comment

drivers/phy/phy-rockchip-usb.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)

Statistics

  • 12 lines added
  • 0 lines removed

Changes

------------------------ drivers/phy/phy-rockchip-usb.c ------------------------
index 62c43c4..e941444 100644
@@ -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;
 
 

Recent Patches

About Us

Sed lacus. Donec lectus. Nullam pretium nibh ut turpis. Nam bibendum. In nulla tortor, elementum vel, tempor at, varius non, purus. Mauris vitae nisl nec metus placerat consectetuer.

Read More...