From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753267AbbBYPQf (ORCPT ); Wed, 25 Feb 2015 10:16:35 -0500 Received: from mail-pa0-f41.google.com ([209.85.220.41]:42644 "EHLO mail-pa0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752491AbbBYPQe (ORCPT ); Wed, 25 Feb 2015 10:16:34 -0500 From: Thierry Reding To: Kishon Vijay Abraham I Cc: linux-kernel@vger.kernel.org Subject: [PATCH] phy: Find the right match in devm_phy_destroy() Date: Wed, 25 Feb 2015 16:16:29 +0100 Message-Id: <1424877389-12450-1-git-send-email-thierry.reding@gmail.com> X-Mailer: git-send-email 2.1.3 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Thierry Reding 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 --- 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