Skip to contentSkip to conversation

phy: Find the right match in devm_phy_destroy()

PATCH New Thierry Reding 1 participant 1 message Feb 25, 2015 Generic PHY framework

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 phy: Find the right match in devm_phy_destroy()

From: Thierry Reding <[email protected]>

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.

---
 drivers/phy/phy-core.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/phy/phy-core.c +3 -1
index a12d35338313..04fc84f2b289 100644
@@ -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;
 }
 
 /**
Signature · 1 line
2.1.3