]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
phy: Find the right match in devm_phy_destroy()
authorThierry Reding <treding@nvidia.com>
Wed, 25 Feb 2015 15:16:29 +0000 (16:16 +0100)
committerLuis Henriques <luis.henriques@canonical.com>
Mon, 30 Mar 2015 10:11:30 +0000 (11:11 +0100)
commit 2f1bce487cd0a02623cff3d877940f9a2026341c upstream.

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.

Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
drivers/phy/phy-core.c

index 49c446530101e2565b3f31b05b814c9a5b57c8ff..b7053d02b8092157c49de659fddea748357f83fc 100644 (file)
@@ -50,7 +50,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)