All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] phy: stih41x-usb: Fixup stih41x_usb_phy_power_on failure path
@ 2015-03-17  0:39 Axel Lin
  2015-03-17  8:06 ` [STLinux Kernel] " Patrice Chotard
  0 siblings, 1 reply; 2+ messages in thread
From: Axel Lin @ 2015-03-17  0:39 UTC (permalink / raw)
  To: linux-arm-kernel

If stih41x_usb_phy_power_on() fails, we need to call clk_disable_unprepare()
before return error. This is to ensure we have balanced clk_enable/disable
calls.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
 drivers/phy/phy-stih41x-usb.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/phy/phy-stih41x-usb.c b/drivers/phy/phy-stih41x-usb.c
index a603801..c093b47 100644
--- a/drivers/phy/phy-stih41x-usb.c
+++ b/drivers/phy/phy-stih41x-usb.c
@@ -87,8 +87,12 @@ static int stih41x_usb_phy_power_on(struct phy *phy)
 		return ret;
 	}
 
-	return regmap_update_bits(phy_dev->regmap, phy_dev->cfg->syscfg,
-			phy_dev->cfg->oscok, phy_dev->cfg->oscok);
+	ret = regmap_update_bits(phy_dev->regmap, phy_dev->cfg->syscfg,
+				 phy_dev->cfg->oscok, phy_dev->cfg->oscok);
+	if (ret)
+		clk_disable_unprepare(phy_dev->clk);
+
+	return ret;
 }
 
 static int stih41x_usb_phy_power_off(struct phy *phy)
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [STLinux Kernel] [PATCH] phy: stih41x-usb: Fixup stih41x_usb_phy_power_on failure path
  2015-03-17  0:39 [PATCH] phy: stih41x-usb: Fixup stih41x_usb_phy_power_on failure path Axel Lin
@ 2015-03-17  8:06 ` Patrice Chotard
  0 siblings, 0 replies; 2+ messages in thread
From: Patrice Chotard @ 2015-03-17  8:06 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Axel

On 03/17/2015 01:39 AM, Axel Lin wrote:
> If stih41x_usb_phy_power_on() fails, we need to call clk_disable_unprepare()
> before return error. This is to ensure we have balanced clk_enable/disable
> calls.
>
> Signed-off-by: Axel Lin <axel.lin@ingics.com>
> ---
>   drivers/phy/phy-stih41x-usb.c | 8 ++++++--
>   1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/phy/phy-stih41x-usb.c b/drivers/phy/phy-stih41x-usb.c
> index a603801..c093b47 100644
> --- a/drivers/phy/phy-stih41x-usb.c
> +++ b/drivers/phy/phy-stih41x-usb.c
> @@ -87,8 +87,12 @@ static int stih41x_usb_phy_power_on(struct phy *phy)
>   		return ret;
>   	}
>   
> -	return regmap_update_bits(phy_dev->regmap, phy_dev->cfg->syscfg,
> -			phy_dev->cfg->oscok, phy_dev->cfg->oscok);
> +	ret = regmap_update_bits(phy_dev->regmap, phy_dev->cfg->syscfg,
> +				 phy_dev->cfg->oscok, phy_dev->cfg->oscok);
> +	if (ret)
> +		clk_disable_unprepare(phy_dev->clk);
> +
> +	return ret;
>   }
>   
>   static int stih41x_usb_phy_power_off(struct phy *phy)

Acked-by: Patrice Chotard <patrice.chotard@st.com>

Thanks

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-03-17  8:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-17  0:39 [PATCH] phy: stih41x-usb: Fixup stih41x_usb_phy_power_on failure path Axel Lin
2015-03-17  8:06 ` [STLinux Kernel] " Patrice Chotard

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.