mirror of
https://github.com/hardkernel/linux.git
synced 2026-04-11 07:28:10 +09:00
UPSTREAM: 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>
(cherry picked from commit 75d390fecf)
Change-Id: I976d5a49448febdb7da5b5c35455c708bfc83899
This commit is contained in:
committed by
Huang, Tao
parent
9e87280e0d
commit
5caeb6eca8
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user