diff options
author | Axel Lin <axel.lin@ingics.com> | 2015-03-06 15:55:10 +0800 |
---|---|---|
committer | Sasha Levin <sasha.levin@oracle.com> | 2016-03-04 10:18:39 -0500 |
commit | 532c6150f4dc54427cc148d0ea8cfb76661f9989 (patch) | |
tree | e4ff8f5c99a5293b6254e3f7fd66f9582e29dfc7 | |
parent | 0f97e402030cb82e5a5ab9ca9babf323d1bc5b74 (diff) | |
download | lwn-532c6150f4dc54427cc148d0ea8cfb76661f9989.tar.gz lwn-532c6150f4dc54427cc148d0ea8cfb76661f9989.zip |
phy: core: Fixup return value of phy_exit when !pm_runtime_enabled
[ Upstream commit 736b67a32062240592aad49033859f9712dd18ca ]
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 <axel.lin@ingics.com>
Acked-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
-rw-r--r-- | drivers/phy/phy-core.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c index 2733112b3527..79f5e9a242c1 100644 --- a/drivers/phy/phy-core.c +++ b/drivers/phy/phy-core.c @@ -179,6 +179,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) { @@ -187,8 +188,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; @@ -209,6 +208,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) { @@ -243,6 +243,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) { @@ -251,8 +252,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); |