Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp542797imm; Tue, 9 Oct 2018 23:49:53 -0700 (PDT) X-Google-Smtp-Source: ACcGV60hHFHELXTU9Fd8ekhTYDk0VVGDAv+aWgLAAbHPQz/5gcucIAPnCu8QTuyQnpKTazmgje9K X-Received: by 2002:a63:4454:: with SMTP id t20-v6mr28177850pgk.102.1539154193112; Tue, 09 Oct 2018 23:49:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539154193; cv=none; d=google.com; s=arc-20160816; b=sZkKxBNkdPLKdJXUVsoABygBshWF+//GBXerjYmXwe0IbJ6g2QNqJCBDy2JSSOQCSS Ko5T2RkUgjoW3/ZvIP8/YkFSjYmp1ykt32zNi8qiPdAl+zy8BJFjAw/+Xcjbqh8o7ORf KEQmTNvFWfvmNJlHYG+dx6v417u7d8Jl/fiyGGPxlThqr4JfpDOigYGqukQGbLLC3OJW R8EGPRnv5/+sxX+gpvhnxd6Ttl0DyWi451h4op2hvO8qAanLgv02cM3Czn98FZN2VcoW PQbTHXZafVCS8NFlGDewOahi6OHqFraXnQYvWsaLpf5/qVjofJHx4mdbngme5GplCS+s D4kg== 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=YFlAa2W4ZSZWe4mVkEkS1/guov36SreVkbc3mFARR24=; b=oTo67JTTgC04aOLylU2V+A8i4fCdx8qazDcwz0JDmAkuS0QKHMADcb5W5H0r+Zhm73 bHrKh1u6X7znjUuUbx+xIriwTa5jHpSeJUF396r8x/E8HwFZhjM8ayGaF/gHznv+pHle 8ViNPwH2zwQeBLKdEv36cnfFX+ygKVv6PYRkN2OFbynJLteq51L9KWSFrhSAdAzbbQdd U4OLk8eSlRCn+UMViOvNGh1NmFsbheb3rQq8qpWJiniO7sNyU/wf4jTquzpU9c33AEQq h//q+Eb6QdvhH02S8iZd2AKaVWJGY4zEjPLKEsxITN5PdbjhNh818QHyvmo8+r8TzMoW 9yrw== 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 h3-v6si23767253plb.122.2018.10.09.23.49.37; Tue, 09 Oct 2018 23:49:53 -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 S1726564AbeJJOJ6 (ORCPT + 99 others); Wed, 10 Oct 2018 10:09:58 -0400 Received: from mail.bootlin.com ([62.4.15.54]:42036 "EHLO mail.bootlin.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725757AbeJJOJ5 (ORCPT ); Wed, 10 Oct 2018 10:09:57 -0400 Received: by mail.bootlin.com (Postfix, from userid 110) id DCB4A207C3; Wed, 10 Oct 2018 08:49:12 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.bootlin.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT shortcircuit=ham autolearn=disabled version=3.4.0 Received: from qschulz (AAubervilliers-681-1-28-153.w90-88.abo.wanadoo.fr [90.88.148.153]) by mail.bootlin.com (Postfix) with ESMTPSA id AC65D20726; Wed, 10 Oct 2018 08:49:02 +0200 (CEST) Date: Wed, 10 Oct 2018 08:49:02 +0200 From: Quentin Schulz To: "Gustavo A. R. Silva" Cc: linux-kernel@vger.kernel.org, Andrew Lunn , Florian Fainelli , "David S. Miller" Subject: Re: [PATCH net-next 2/2] net: phy: mscc: fix memory leak in vsc8574_config_pre_init Message-ID: <20181010064902.qnrkoi3wdf6hlyac@qschulz> References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="q5dbc5my6jlprb7l" Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20171215 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --q5dbc5my6jlprb7l Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi Gustavo, On Tue, Oct 09, 2018 at 09:39:53PM +0200, Gustavo A. R. Silva wrote: > In case memory resources for *fw* were successfully allocated, > release them before return. >=20 > 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(-) >=20 > 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_devic= e *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_devic= e *phydev) > =20 > out: > phy_base_write(phydev, MSCC_EXT_PAGE_ACCESS, MSCC_PHY_PAGE_STANDARD); > - > +release_fw: > release_firmware(fw); You can reuse the out goto label instead, I would like all functions in the driver to exit with the PHY set to access the standard page. Thanks, Quentin --q5dbc5my6jlprb7l Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEXeEYjDsJh38OoyMzhLiadT7g8aMFAlu9oN0ACgkQhLiadT7g 8aOigw/7BvC8ASIU7oRGAjQ24rM03SfBjra6yolfMIkKhkpLTDtTHmym5Qya04s4 nonW4U8aM8Skv0OUoxY9TvC7YIo/MMzTy3+H4rwwOYlVNDVpOQpyffRuadEXE3kz hlUYbUCekGP0WSWNaaZeRcL+Ivyz9REgqAYsyevTW2JtbmjYTXoFvsT8VoD20gzE 4Q1IgC62b6DyTtrQmG3Am+CmooIUDpeuMN1wSfOJDKk3CPs8M2J6t8TVX9KlsmHB pxk/SnwI9c48E7cT9SBWY3Q3HsbXHkQ/x5LvkXOzLa6hr4wW12a+tgQxkO/97vzJ +3PzK/2WVrZXcR9ag6mUYFdBnAw9sSZnqvwMcnEob2kekUFhtLy3UnBO8K7xn0M4 kum4OMO+Dk0hq31Dcz7Bh82MiRvDNu88cSjNLAbQmgV7ELFCcQtxN42TsHqUXb/7 GrkxaSJzHneeBVAmOAMLrWy4/A/OENCtkySz0v4mF/DFk0ZLtZ/B0W4CS06CEwjI 6iP1kUOhXVupIXlmasphGwrY0DOUtoKsT4v5M7rZdcSOC+SREpInKZZmw3+zocgN r1qjThW9Va+gYL6MF+HZxOcDFTHamhqmYQl6kl3T8VTu7YNWkoniglX7Rg98M/i2 QHCE6Fk/StqPOgeqZnH/DXdW8o6znggjteHTgahW9lZ8zfK6j/Y= =ETCU -----END PGP SIGNATURE----- --q5dbc5my6jlprb7l--