Commit 9e8da08d authored by Thierry Reding's avatar Thierry Reding Committed by Greg Kroah-Hartman

phy: Find the right match in devm_phy_destroy()

commit 2f1bce48 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: default avatarThierry Reding <treding@nvidia.com>
Signed-off-by: default avatarKishon Vijay Abraham I <kishon@ti.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent d3f483f0
...@@ -50,7 +50,9 @@ static void devm_phy_consume(struct device *dev, void *res) ...@@ -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) 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) static struct phy *phy_lookup(struct device *device, const char *port)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment