From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933706AbbCFKLr (ORCPT ); Fri, 6 Mar 2015 05:11:47 -0500 Received: from devils.ext.ti.com ([198.47.26.153]:58419 "EHLO devils.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932284AbbCFKLn (ORCPT ); Fri, 6 Mar 2015 05:11:43 -0500 Message-ID: <54F97D5A.60302@ti.com> Date: Fri, 6 Mar 2015 12:11:38 +0200 From: Roger Quadros User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: Axel Lin , Kishon Vijay Abraham I CC: "linux-kernel@vger.kernel.org" Subject: Re: [PATCH] phy: core: Fixup return value of phy_exit when !pm_runtime_enabled References: <1425628510.25002.1.camel@phoenix> In-Reply-To: <1425628510.25002.1.camel@phoenix> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 06/03/15 09:55, Axel Lin wrote: > When phy_pm_runtime_get_sync() returns -ENOTSUPP, phy_exit() also returns > -ENOTSUPP if !phy->ops->exit. Fix it. > Also move the code to override ret close to the code we got ret. > I think it is less error prone this way. > > Signed-off-by: Axel Lin Acked-by: Roger Quadros cheers, -roger > --- > drivers/phy/phy-core.c | 7 +++---- > 1 file changed, 3 insertions(+), 4 deletions(-) > > diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c > index a12d353..250dc6c 100644 > --- a/drivers/phy/phy-core.c > +++ b/drivers/phy/phy-core.c > @@ -223,6 +223,7 @@ int phy_init(struct phy *phy) > ret = phy_pm_runtime_get_sync(phy); > if (ret < 0 && ret != -ENOTSUPP) > return ret; > + ret = 0; /* Override possible ret == -ENOTSUPP */ > > mutex_lock(&phy->mutex); > if (phy->init_count == 0 && phy->ops->init) { > @@ -231,8 +232,6 @@ int phy_init(struct phy *phy) > dev_err(&phy->dev, "phy init failed --> %d\n", ret); > goto out; > } > - } else { > - ret = 0; /* Override possible ret == -ENOTSUPP */ > } > ++phy->init_count; > > @@ -253,6 +252,7 @@ int phy_exit(struct phy *phy) > ret = phy_pm_runtime_get_sync(phy); > if (ret < 0 && ret != -ENOTSUPP) > return ret; > + ret = 0; /* Override possible ret == -ENOTSUPP */ > > mutex_lock(&phy->mutex); > if (phy->init_count == 1 && phy->ops->exit) { > @@ -287,6 +287,7 @@ int phy_power_on(struct phy *phy) > ret = phy_pm_runtime_get_sync(phy); > if (ret < 0 && ret != -ENOTSUPP) > return ret; > + ret = 0; /* Override possible ret == -ENOTSUPP */ > > mutex_lock(&phy->mutex); > if (phy->power_count == 0 && phy->ops->power_on) { > @@ -295,8 +296,6 @@ int phy_power_on(struct phy *phy) > dev_err(&phy->dev, "phy poweron failed --> %d\n", ret); > goto out; > } > - } else { > - ret = 0; /* Override possible ret == -ENOTSUPP */ > } > ++phy->power_count; > mutex_unlock(&phy->mutex); >