From patchwork Mon Nov 28 18:25:01 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johan Hovold X-Patchwork-Id: 700111 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3tSG0v0TXBz9t0t for ; Tue, 29 Nov 2016 05:48:47 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Yb4lkkbx"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3tSG0t6XBszDwGS for ; Tue, 29 Nov 2016 05:48:46 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Yb4lkkbx"; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Received: from mail-lf0-x241.google.com (mail-lf0-x241.google.com [IPv6:2a00:1450:4010:c07::241]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3tSFXP4tW2zDvhR for ; Tue, 29 Nov 2016 05:27:33 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="Yb4lkkbx"; dkim-atps=neutral Received: by mail-lf0-x241.google.com with SMTP id o141so10369199lff.1 for ; Mon, 28 Nov 2016 10:27:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=JxhG/SKj6hyFWZ6z3goANqOD3v4aGyUbxaqHO1Dwilc=; b=Yb4lkkbxcuXpJKxfGgv/xvCBYLR78uVEvjIIBKNgMb1vfOYRfUbJGcDdUrmOopofbK +xl7U17Nc2IUAoidpFDgn/4UOhV+rziKj1bdcgsqumHkpeABuh6biVvtGLouYskJPO9p iWm1pnBMOIIuQc1nn/kyNLAw55kLJnGgIXC6XHdNrWqe7yUOhT3C77pxKjAMn1JoAUir mVPM3Ek7IRpafpd+s7O32fAKe6F1MkmVcZUC8F/jfWT6Idfu4apg+/9GaGxQDl+siiSb Hlg8TbigQPW5XzXBIL1XGvXUlUT2Q+IRU+SfZTqiS5Q5fnvHifXujJllhdSj/YmdOZSG poBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=JxhG/SKj6hyFWZ6z3goANqOD3v4aGyUbxaqHO1Dwilc=; b=fLu9uQfs3Od1+DyTsFI4IYAh1lxOXwCTnXjLFzIqacNSLpBrPsn0KNVzytH/OtIWLB Y/mklEBEQlJrrGAYPUUoJ5RKM2C9OvVwrsylOti8Zj7tC9JucduM55f7MaHLh4DsAe7A HJDc+tfhy4vaEhAYPvdhBkCQQHZhoxZGK9Ji1FrEuyv7hLj0bG55VbejQOjJAIJjx2zA LAMVvDSqf68J48qHSDWsxsf/D/ERo99OeLOXbR2sbznm+Qk+Y5RUh5iyHPt2e8vnzPHx YwSutwF/cgc22PyYctLa+o2nvaIjLUh3C0yi8CeLkijM0pq+VufbfWJQZDv9NmLb5753 SgZQ== X-Gm-Message-State: AKaTC00RcmF4c7M3lPXWYbgyFAgtDRdX6MnM9eMv1T6tk7soXrEwyLCQMt0LrD8B5rc3ZA== X-Received: by 10.46.5.140 with SMTP id 134mr10713308ljf.66.1480357650800; Mon, 28 Nov 2016 10:27:30 -0800 (PST) Received: from xi.terra (c-04aadb54.07-184-6d6c6d4.cust.bredbandsbolaget.se. [84.219.170.4]) by smtp.gmail.com with ESMTPSA id e78sm13025870lfg.23.2016.11.28.10.27.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 28 Nov 2016 10:27:27 -0800 (PST) Received: from johan by xi.terra with local (Exim 4.87) (envelope-from ) id 1cBQeA-0007KZ-Eo; Mon, 28 Nov 2016 19:27:22 +0100 From: Johan Hovold To: "David S. Miller" Subject: [PATCH net 08/16] net: ethernet: fs_enet: fix fixed-link phydev leaks Date: Mon, 28 Nov 2016 19:25:01 +0100 Message-Id: <1480357509-28074-9-git-send-email-johan@kernel.org> X-Mailer: git-send-email 2.7.3 In-Reply-To: <1480357509-28074-1-git-send-email-johan@kernel.org> References: <1480357509-28074-1-git-send-email-johan@kernel.org> X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrew Lunn , devicetree@vger.kernel.org, Frank Rowand , Felix Fietkau , Florian Fainelli , Claudiu Manoil , Mugunthan V N , Grygorii Strashko , linuxppc-dev@lists.ozlabs.org, Johan Hovold , Rob Herring , linux-mediatek@lists.infradead.org, Lars Persson , Matthias Brugger , linux-omap@vger.kernel.org, John Crispin , Thomas Petazzoni , Fugang Duan , Sergei Shtylyov , Vivien Didelot , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Vitaly Bordug , nios2-dev@lists.rocketboards.org, Vince Bridgers Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" Make sure to deregister and free any fixed-link PHY registered using of_phy_register_fixed_link() on probe errors and on driver unbind. Fixes: bb74d9a4a87b ("fs_enet: use the new fixed PHY helpers") Signed-off-by: Johan Hovold --- drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c b/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c index dc120c148d97..4b86260584a0 100644 --- a/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c +++ b/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c @@ -980,7 +980,7 @@ static int fs_enet_probe(struct platform_device *ofdev) err = clk_prepare_enable(clk); if (err) { ret = err; - goto out_free_fpi; + goto out_deregister_fixed_link; } fpi->clk_per = clk; } @@ -1061,6 +1061,9 @@ static int fs_enet_probe(struct platform_device *ofdev) of_node_put(fpi->phy_node); if (fpi->clk_per) clk_disable_unprepare(fpi->clk_per); +out_deregister_fixed_link: + if (of_phy_is_fixed_link(ofdev->dev.of_node)) + of_phy_deregister_fixed_link(ofdev->dev.of_node); out_free_fpi: kfree(fpi); return ret; @@ -1079,6 +1082,8 @@ static int fs_enet_remove(struct platform_device *ofdev) of_node_put(fep->fpi->phy_node); if (fep->fpi->clk_per) clk_disable_unprepare(fep->fpi->clk_per); + if (of_phy_is_fixed_link(ofdev->dev.of_node)) + of_phy_deregister_fixed_link(ofdev->dev.of_node); free_netdev(ndev); return 0; }