All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] phy: Find the right match in devm_phy_destroy()
@ 2015-02-25 15:16 Thierry Reding
  0 siblings, 0 replies; only message in thread
From: Thierry Reding @ 2015-02-25 15:16 UTC (permalink / raw)
  To: Kishon Vijay Abraham I; +Cc: linux-kernel

From: Thierry Reding <treding@nvidia.com>

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>
---
 drivers/phy/phy-core.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c
index a12d35338313..04fc84f2b289 100644
--- a/drivers/phy/phy-core.c
+++ b/drivers/phy/phy-core.c
@@ -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;
 }
 
 /**
-- 
2.1.3


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2015-02-25 15:16 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-25 15:16 [PATCH] phy: Find the right match in devm_phy_destroy() Thierry Reding

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.