summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThierry Reding <treding@nvidia.com>2015-02-25 16:16:29 +0100
committerSasha Levin <sasha.levin@oracle.com>2015-04-16 20:11:41 -0400
commit59bbaa453dd58db66cd0bb9ca309aa36f4567778 (patch)
treefbf2b428c43bc75a9743ee831547834d51c1b8ad
parentbf8935d8ac4130b11b8e09623c496bfb3f730c95 (diff)
phy: Find the right match in devm_phy_destroy()
[ Upstream commit 2f1bce487cd0a02623cff3d877940f9a2026341c ] devm_phy_create() stores the pointer to the new PHY at the address returned by devres_alloc(). The res parameter passed to devm_phy_match() is therefore the location where the pointer to the PHY is stored, hence it needs to be dereferenced before comparing to the match data in order to find the correct match. Cc: <stable@vger.kernel.org> # v3.13+ Signed-off-by: Thierry Reding <treding@nvidia.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.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c
index ff5eec5af817..2733112b3527 100644
--- a/drivers/phy/phy-core.c
+++ b/drivers/phy/phy-core.c
@@ -51,7 +51,9 @@ static void devm_phy_consume(struct device *dev, void *res)
static int devm_phy_match(struct device *dev, void *res, void *match_data)
{
- return res == match_data;
+ struct phy **phy = res;
+
+ return *phy == match_data;
}
static struct phy *phy_lookup(struct device *device, const char *port)