public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Kishon Vijay Abraham I <kishon@ti.com>
To: Shawn Lin <shawn.lin@rock-chips.com>
Cc: <linux-kernel@vger.kernel.org>, Roger Quadros <rogerq@ti.com>,
	Axel Lin <axel.lin@ingics.com>
Subject: Re: [PATCH] phy: core: fix wrong err handle for phy_power_on
Date: Wed, 3 Feb 2016 11:55:09 +0530	[thread overview]
Message-ID: <56B19D45.70705@ti.com> (raw)
In-Reply-To: <1453968858-1026-1-git-send-email-shawn.lin@rock-chips.com>

Hi,

On Thursday 28 January 2016 01:44 PM, Shawn Lin wrote:
> If phy_pm_runtime_get_sync failed but we already
> enable regulator, current code return directly without
> doing regulator_disable. This patch fix this problem
> and cleanup err handle of phy_power_on to be more readable.
> 
> Fixes: 3be88125d85d ("phy: core: Support regulator ...")
> Cc: Roger Quadros <rogerq@ti.com>
> Cc: Axel Lin <axel.lin@ingics.com>
> Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>

Thank you for fixing this. Merged it.

Thanks
Kishon

> ---
> 
>  drivers/phy/phy-core.c | 16 +++++++++-------
>  1 file changed, 9 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c
> index 8c7f27d..e7e574d 100644
> --- a/drivers/phy/phy-core.c
> +++ b/drivers/phy/phy-core.c
> @@ -275,20 +275,21 @@ EXPORT_SYMBOL_GPL(phy_exit);
>  
>  int phy_power_on(struct phy *phy)
>  {
> -	int ret;
> +	int ret = 0;
>  
>  	if (!phy)
> -		return 0;
> +		goto out;
>  
>  	if (phy->pwr) {
>  		ret = regulator_enable(phy->pwr);
>  		if (ret)
> -			return ret;
> +			goto out;
>  	}
>  
>  	ret = phy_pm_runtime_get_sync(phy);
>  	if (ret < 0 && ret != -ENOTSUPP)
> -		return ret;
> +		goto err_pm_sync;
> +
>  	ret = 0; /* Override possible ret == -ENOTSUPP */
>  
>  	mutex_lock(&phy->mutex);
> @@ -296,19 +297,20 @@ int phy_power_on(struct phy *phy)
>  		ret = phy->ops->power_on(phy);
>  		if (ret < 0) {
>  			dev_err(&phy->dev, "phy poweron failed --> %d\n", ret);
> -			goto out;
> +			goto err_pwr_on;
>  		}
>  	}
>  	++phy->power_count;
>  	mutex_unlock(&phy->mutex);
>  	return 0;
>  
> -out:
> +err_pwr_on:
>  	mutex_unlock(&phy->mutex);
>  	phy_pm_runtime_put_sync(phy);
> +err_pm_sync:
>  	if (phy->pwr)
>  		regulator_disable(phy->pwr);
> -
> +out:
>  	return ret;
>  }
>  EXPORT_SYMBOL_GPL(phy_power_on);
> 

      reply	other threads:[~2016-02-03  6:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-28  8:14 [PATCH] phy: core: fix wrong err handle for phy_power_on Shawn Lin
2016-02-03  6:25 ` Kishon Vijay Abraham I [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56B19D45.70705@ti.com \
    --to=kishon@ti.com \
    --cc=axel.lin@ingics.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rogerq@ti.com \
    --cc=shawn.lin@rock-chips.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox