diff options
author | Rakesh Bodla <rbodla@nvidia.com> | 2012-07-28 00:08:08 +0530 |
---|---|---|
committer | Rohan Somvanshi <rsomvanshi@nvidia.com> | 2012-07-31 03:42:53 -0700 |
commit | b4e9ece3b32afea9ca8d761c285fc9bc4c70b967 (patch) | |
tree | 5e52ed49668caf513975f7ce3071f4dd05ee3d94 /arch/arm/mach-tegra/usb_phy.c | |
parent | 0158c77a8bede54da353a2069b5c4bf71c078c3a (diff) |
ARM: tegra: usb: free allocated resources in error
Free allocated resources at approriate error
conditions.
Change-Id: I548f6ac7ad65eae93f9f49b0a5fa7ffff9685241
Signed-off-by: Rakesh Bodla <rbodla@nvidia.com>
Reviewed-on: http://git-master/r/119039
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Venkat Moganty <vmoganty@nvidia.com>
Diffstat (limited to 'arch/arm/mach-tegra/usb_phy.c')
-rw-r--r-- | arch/arm/mach-tegra/usb_phy.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/arch/arm/mach-tegra/usb_phy.c b/arch/arm/mach-tegra/usb_phy.c index 4cc80e68d89c..00a44dd2536c 100644 --- a/arch/arm/mach-tegra/usb_phy.c +++ b/arch/arm/mach-tegra/usb_phy.c @@ -173,7 +173,8 @@ static int tegra_usb_phy_get_clocks(struct tegra_usb_phy *phy) phy->pllu_clk = clk_get_sys(NULL, "pll_u"); if (IS_ERR(phy->pllu_clk)) { ERR("inst:[%d] Can't get pllu_clk clock\n", phy->inst); - return PTR_ERR(phy->pllu_clk); + err = PTR_ERR(phy->pllu_clk); + goto fail_pll; } clk_enable(phy->pllu_clk); @@ -221,6 +222,7 @@ fail_ctrlr_clk: clk_disable(phy->pllu_clk); clk_put(phy->pllu_clk); +fail_pll: return err; } @@ -263,13 +265,15 @@ struct tegra_usb_phy *tegra_usb_phy_open(struct platform_device *pdev) res = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!res) { ERR("inst:[%d] failed to get I/O memory\n", phy->inst); - return ERR_PTR(-ENXIO); + err = -ENXIO; + goto fail_io; } phy->regs = ioremap(res->start, resource_size(res)); if (!phy->regs) { ERR("inst:[%d] Failed to remap I/O memory\n", phy->inst); - return ERR_PTR(-ENOMEM); + err = -ENOMEM; + goto fail_io; } phy->vdd_reg = regulator_get(NULL, "avdd_usb"); @@ -372,6 +376,9 @@ fail_init: fail_clk: regulator_put(phy->vdd_reg); iounmap(phy->regs); +fail_io: + kfree(phy); + return ERR_PTR(err); } @@ -410,8 +417,10 @@ void tegra_usb_phy_close(struct tegra_usb_phy *phy) regulator_put(phy->vdd_reg); } - tegra_usb_phy_release_clocks(phy); + + kfree(phy->pdata); + kfree(phy); } irqreturn_t tegra_usb_phy_irq(struct tegra_usb_phy *phy) |