Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp630314imm; Wed, 10 Oct 2018 01:32:43 -0700 (PDT) X-Google-Smtp-Source: ACcGV60dsyIS4uya9FhPO/xwjdxKD/rQediT4QlztFt0jwBdciubl9F/QzEpc7bIg9RFZYxYT99N X-Received: by 2002:a62:85cb:: with SMTP id m72-v6mr33659058pfk.173.1539160363464; Wed, 10 Oct 2018 01:32:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539160363; cv=none; d=google.com; s=arc-20160816; b=Q3dzS+i/mhtgpLSgZjf77/Ci/3LMLJDjZaJi4zD5qGzhJhwBlVnH/iFB5HfoQlYuC1 mxntp5tvsZ55mO3W95JnEUONR9WAZ2GhXQJzUBgOveq0fShxsc7X+LOrL7uINpxUwGuV cL7gYwBU6PHW+zMyQQIGnvKzllmRx2K8LZR3yFiNw7m2ogfEzx3Qf3xK7Ky1EhFolcEN 7Cc4THkwqjnK1j12sgNsTS43ALhEZnYe9vATGO/mepPyaW973hrbHzKmxzY6HpseTLQX KiDVTYVM2FZ+e+IP1RT3DapySuriYIVYtZJh3fLhzTyJ53URsOGq6D0hkCY8G97O7BKk L+6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=PASk+DQGqCEFsrBMK79V4HeDLxWVVWcqwqZVD11o86I=; b=wcMTcXi9DlmB7Qj4th5i4jsOVfn+YVKMk8z79HBuuSraZdrdfXHTWRXAfj3ZMTZTRK e6sAiYK87YNAiKaC0QmkGdtSy9mCecn1q65vrHO8gR9Zd1IfRPLskecuQRE8eAdKua53 pZOe798Y8UXEWGSfH2j1cLLdPH9pCkT/NBOfO3Gr8wYBejWVGceMtv0+e+wvB0y6BCKx j/BAr7O19ww1j9XU8sYTYdPrvAmiICHkkcoTAfFC2WQu/gj8AGvUC70BZ2CjOERQbmQa BoOheBLkokEKfZjtNh2wZzjNBpwD0FhIf+Yw0S0ONJaMjnC65QocVKbnETZKn2XgHL35 Pf3g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 1-v6si23986260plz.220.2018.10.10.01.32.29; Wed, 10 Oct 2018 01:32:43 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727401AbeJJPwt (ORCPT + 99 others); Wed, 10 Oct 2018 11:52:49 -0400 Received: from gateway33.websitewelcome.com ([192.185.146.210]:47289 "EHLO gateway33.websitewelcome.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727128AbeJJPwt (ORCPT ); Wed, 10 Oct 2018 11:52:49 -0400 Received: from cm11.websitewelcome.com (cm11.websitewelcome.com [100.42.49.5]) by gateway33.websitewelcome.com (Postfix) with ESMTP id 8EDDA6E1EC4 for ; Wed, 10 Oct 2018 03:31:43 -0500 (CDT) Received: from gator4166.hostgator.com ([108.167.133.22]) by cmsmtp with SMTP id A9u9gFePsRPojA9uAgXmnz; Wed, 10 Oct 2018 03:31:43 -0500 X-Authority-Reason: nr=8 Received: from 57.154.24.109.rev.sfr.net ([109.24.154.57]:42514 helo=embeddedor) by gator4166.hostgator.com with esmtpa (Exim 4.91) (envelope-from ) id 1gA9u8-000MRb-WB; Wed, 10 Oct 2018 03:31:41 -0500 Date: Wed, 10 Oct 2018 10:31:39 +0200 From: "Gustavo A. R. Silva" To: linux-kernel@vger.kernel.org Cc: Andrew Lunn , Florian Fainelli , "David S. Miller" , Quentin Schulz , "Gustavo A. R. Silva" Subject: [PATCH net-next v2 2/2] net: phy: mscc: fix memory leak in vsc8574_config_pre_init Message-ID: <6161326e265a99f8ec8e0f7028790a0131c5404e.1539159556.git.gustavo@embeddedor.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator4166.hostgator.com X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - embeddedor.com X-BWhitelist: no X-Source-IP: 109.24.154.57 X-Source-L: No X-Exim-ID: 1gA9u8-000MRb-WB X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 57.154.24.109.rev.sfr.net (embeddedor) [109.24.154.57]:42514 X-Source-Auth: gustavo@embeddedor.com X-Email-Count: 16 X-Source-Cap: Z3V6aWRpbmU7Z3V6aWRpbmU7Z2F0b3I0MTY2Lmhvc3RnYXRvci5jb20= X-Local-Domain: yes Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In case memory resources for *fw* were successfully allocated, release them before return. Addresses-Coverity-ID: 1473968 ("Resource leak") Fixes: 00d70d8e0e78 ("net: phy: mscc: add support for VSC8574 PHY") Signed-off-by: Gustavo A. R. Silva --- Changes in v2: - Jump to out label so all functions in the driver exit with the PHY set to access the standard page. Thanks to Quentin Schulz for pointing this out. drivers/net/phy/mscc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/phy/mscc.c b/drivers/net/phy/mscc.c index bff56c3..a2e59f4 100644 --- a/drivers/net/phy/mscc.c +++ b/drivers/net/phy/mscc.c @@ -1292,7 +1292,7 @@ static int vsc8574_config_pre_init(struct phy_device *phydev) dev_err(dev, "%s: failed to assert reset of micro\n", __func__); - return ret; + goto out; } } } else { -- 2.7.4