From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755028AbbCMMC1 (ORCPT ); Fri, 13 Mar 2015 08:02:27 -0400 Received: from bear.ext.ti.com ([192.94.94.41]:41742 "EHLO bear.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932194AbbCMMCW (ORCPT ); Fri, 13 Mar 2015 08:02:22 -0400 From: Kishon Vijay Abraham I To: CC: , Subject: [PATCH 13/20] phy: Find the right match in devm_phy_destroy() Date: Fri, 13 Mar 2015 17:31:50 +0530 Message-ID: <1426248117-14312-14-git-send-email-kishon@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1426248117-14312-1-git-send-email-kishon@ti.com> References: <1426248117-14312-1-git-send-email-kishon@ti.com> MIME-Version: 1.0 Content-Type: text/plain 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 Signed-off-by: Kishon Vijay Abraham I Cc: # v3.13+ --- 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 a12d353..04fc84f 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; } /** -- 1.7.9.5