Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757925AbdLRDMl (ORCPT ); Sun, 17 Dec 2017 22:12:41 -0500 Received: from mail-pl0-f68.google.com ([209.85.160.68]:37965 "EHLO mail-pl0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757733AbdLRDMj (ORCPT ); Sun, 17 Dec 2017 22:12:39 -0500 X-Google-Smtp-Source: ACJfBou4echTzpGuXq2/UAneY206bLZPR7SXzDVfXUHalMtcJ8YfbbLqVKzXO8QAuoEzNhvywMh03sfjiJVwd1VUJDs= MIME-Version: 1.0 In-Reply-To: <1513374759-21384-1-git-send-email-khoroshilov@ispras.ru> References: <1513374759-21384-1-git-send-email-khoroshilov@ispras.ru> From: Quan Nguyen Date: Mon, 18 Dec 2017 10:12:38 +0700 Message-ID: Subject: Re: [PATCH] net: phy: xgene: disable clk on error paths To: Alexey Khoroshilov Cc: Iyappan Subramanian , Keyur Chudgar , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, ldv-project@linuxtesting.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2299 Lines: 77 On Sat, Dec 16, 2017 at 4:52 AM, Alexey Khoroshilov wrote: > > There are several error paths in xgene_mdio_probe(), > where clk is left undisabled. The patch fixes them. > > Found by Linux Driver Verification project (linuxtesting.org). > > Signed-off-by: Alexey Khoroshilov > --- > drivers/net/phy/mdio-xgene.c | 21 +++++++++++++++------ > 1 file changed, 15 insertions(+), 6 deletions(-) > > diff --git a/drivers/net/phy/mdio-xgene.c b/drivers/net/phy/mdio-xgene.c > index bfd3090fb055..07c6048200c6 100644 > --- a/drivers/net/phy/mdio-xgene.c > +++ b/drivers/net/phy/mdio-xgene.c > @@ -194,8 +194,11 @@ static int xgene_mdio_reset(struct xgene_mdio_pdata *pdata) > } > > ret = xgene_enet_ecc_init(pdata); > - if (ret) > + if (ret) { > + if (pdata->dev->of_node) > + clk_disable_unprepare(pdata->clk); > return ret; > + } > xgene_gmac_reset(pdata); > > return 0; > @@ -388,8 +391,10 @@ static int xgene_mdio_probe(struct platform_device *pdev) > return ret; > > mdio_bus = mdiobus_alloc(); > - if (!mdio_bus) > - return -ENOMEM; > + if (!mdio_bus) { > + ret = -ENOMEM; > + goto out_clk; > + } > > mdio_bus->name = "APM X-Gene MDIO bus"; > > @@ -418,7 +423,7 @@ static int xgene_mdio_probe(struct platform_device *pdev) > mdio_bus->phy_mask = ~0; > ret = mdiobus_register(mdio_bus); > if (ret) > - goto out; > + goto out_mdiobus; > > acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_HANDLE(dev), 1, > acpi_register_phy, NULL, mdio_bus, NULL); > @@ -426,16 +431,20 @@ static int xgene_mdio_probe(struct platform_device *pdev) > } > > if (ret) > - goto out; > + goto out_mdiobus; > > pdata->mdio_bus = mdio_bus; > xgene_mdio_status = true; > > return 0; > > -out: > +out_mdiobus: > mdiobus_free(mdio_bus); > > +out_clk: > + if (dev->of_node) > + clk_disable_unprepare(pdata->clk); > + > return ret; > } > Acked.