Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755937AbbDUPdf (ORCPT ); Tue, 21 Apr 2015 11:33:35 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:57297 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754570AbbDUPda (ORCPT ); Tue, 21 Apr 2015 11:33:30 -0400 From: Luis Henriques To: linux-kernel@vger.kernel.org, stable@vger.kernel.org, kernel-team@lists.ubuntu.com Cc: Thierry Reding , Kishon Vijay Abraham I , Luis Henriques Subject: [PATCH 3.16.y-ckt 048/144] phy: Find the right match in devm_phy_destroy() Date: Tue, 21 Apr 2015 16:30:33 +0100 Message-Id: <1429630329-21748-49-git-send-email-luis.henriques@canonical.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1429630329-21748-1-git-send-email-luis.henriques@canonical.com> References: <1429630329-21748-1-git-send-email-luis.henriques@canonical.com> X-Extended-Stable: 3.16 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1498 Lines: 41 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) -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/