Skip to content

Commit

Permalink
phy: Find the right match in devm_phy_destroy()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Thierry Reding authored and Kishon Vijay Abraham I committed Mar 13, 2015
1 parent 6b08e36 commit 2f1bce4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/phy/phy-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/**
Expand Down

0 comments on commit 2f1bce4

Please sign in to comment.