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)
committerKishon Vijay Abraham I <kishon@ti.com>
Fri, 13 Mar 2015 11:43:52 +0000 (17:13 +0530)
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>
drivers/phy/phy-core.c

index a12d35338313bd4f4a67117f3c5c3f76030e53fd..04fc84f2b289907243113e7e0d697cd2411b4e52 100644 (file)
@@ -52,7 +52,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;
 }
 
 /**