[lkml]   [2015]   [Apr]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[PATCH 3.16.y-ckt 048/144] phy: Find the right match in devm_phy_destroy()
3.16.7-ckt10 -stable review patch.  If anyone has any objections, please let me know.


From: Thierry Reding <>

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 <>
Signed-off-by: Kishon Vijay Abraham I <>
Signed-off-by: Luis Henriques <>
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 49c446530101..b7053d02b809 100644
--- a/drivers/phy/phy-core.c
+++ b/drivers/phy/phy-core.c
@@ -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)

 \ /
  Last update: 2015-04-21 17:41    [W:0.326 / U:0.956 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site