Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp5297614imm; Tue, 9 Oct 2018 12:42:31 -0700 (PDT) X-Google-Smtp-Source: ACcGV60ageQ9JfVF0erWmILwFruqmkrtw8SyJZ1TLC/G3M942uKstF52cnNbWM4W8iGgpdHX7wKk X-Received: by 2002:a17:902:4a0c:: with SMTP id w12-v6mr29505748pld.289.1539114145609; Tue, 09 Oct 2018 12:42:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539114145; cv=none; d=google.com; s=arc-20160816; b=PAVumOvWsJeX0PStGv5lFEUrPj5XnWSUE0I1iar4/lx5k2wPBO8aAaU9S42VmnBPfl A+3sqlZriOyS2iLEjExfP8IXHZcRoZZ8D42Uo6tQXyLCkXdfSc+F0rkFtD9vbe477Oh4 ZsF7izr8r9nB0o47QR43lEPk2qjVIcNI6IzVfA+ep5UpvLkMDSYK3WaeiD0uBk/LN3P+ kYZWO8TQFtWY1Xr5e5UceCylhn0fhZr3IjyQCsJ6tzuqr5d9q/+LJ1lnSTc4MNGm7rbY o4c7j3cGf9EIOcRWfB4Jm2VtRq6Od0s2lxbMyf4DqHIc30HZrCGnUHprupL9Q6zHg2ko U89w== 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=nLWSXw+Oyuk9/BHwwgOvLmj/lvKq/hQEdOp9L5oCn+Y=; b=vQwihx9lM3o0icHbYWnIxnyU+1z7OABxK4PoVQH+e6eQVostZsRdtQfzJT/QA99BE3 2lzqU9Fa58qnjclCXf1NkSXvLLWsglKaoKPdN2KzPpfy36i37RvOksvQeEHrqpPyRCXE P4elAcyDDLZH3pjcjeXXbOLW6Nt3Rfjhm6tE5CACjP8HiWmlhIupeKc2mnhVN0DjrDKq 0FCqkEiUSGYiDhUzS0YT2SDzSURE38rFw1CEq07Yo6/8zTjJ3udOuHrpsry58iVdXHYt +JIUL3BogBaSTRxCij1h8PB/QmjzdoaKPfUXDOu1UXsuisBHNRh/M0phtdA0Uf/VXyS6 SFeQ== 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 i4-v6si19561737pgk.564.2018.10.09.12.42.09; Tue, 09 Oct 2018 12:42:25 -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 S1727768AbeJJC6u (ORCPT + 99 others); Tue, 9 Oct 2018 22:58:50 -0400 Received: from gateway21.websitewelcome.com ([192.185.45.133]:46203 "EHLO gateway21.websitewelcome.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726935AbeJJC6t (ORCPT ); Tue, 9 Oct 2018 22:58:49 -0400 Received: from cm15.websitewelcome.com (cm15.websitewelcome.com [100.42.49.9]) by gateway21.websitewelcome.com (Postfix) with ESMTP id D8DDE400D25EC for ; Tue, 9 Oct 2018 14:40:18 -0500 (CDT) Received: from gator4166.hostgator.com ([108.167.133.22]) by cmsmtp with SMTP id 9xrIgmUnM8YaU9xrVgEF7a; Tue, 09 Oct 2018 14:40:18 -0500 X-Authority-Reason: nr=8 Received: from 57.154.24.109.rev.sfr.net ([109.24.154.57]:39214 helo=embeddedor) by gator4166.hostgator.com with esmtpa (Exim 4.91) (envelope-from ) id 1g9xrH-001wGd-9V; Tue, 09 Oct 2018 14:39:55 -0500 Date: Tue, 9 Oct 2018 21:39:53 +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 2/2] net: phy: mscc: fix memory leak in vsc8574_config_pre_init Message-ID: 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: 1g9xrH-001wGd-9V X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 57.154.24.109.rev.sfr.net (embeddedor) [109.24.154.57]:39214 X-Source-Auth: gustavo@embeddedor.com X-Email-Count: 20 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 --- drivers/net/phy/mscc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/phy/mscc.c b/drivers/net/phy/mscc.c index bff56c3..af9fb2d 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 release_fw; } } } else { @@ -1338,7 +1338,7 @@ static int vsc8574_config_pre_init(struct phy_device *phydev) out: phy_base_write(phydev, MSCC_EXT_PAGE_ACCESS, MSCC_PHY_PAGE_STANDARD); - +release_fw: release_firmware(fw); return ret; -- 2.7.4