Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1419113pxa; Sun, 23 Aug 2020 02:06:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxJdlyIWZUXUhVKH0q/7h+2purUFYDj6cxfjR4q5ZjXBAgWQj+/L1DWQy+CzQItetxaL9Bl X-Received: by 2002:a17:906:768c:: with SMTP id o12mr690467ejm.269.1598173578836; Sun, 23 Aug 2020 02:06:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598173578; cv=none; d=google.com; s=arc-20160816; b=czdmwXFJk8+pf1AIUz7mD4LOJjulNpxXKnexptfVK+QkVSW6VeVgHfSFgwSiRdB3w2 X+OJk2lgQ9fuFAH47XGccVQdQxk9KjnFrh1/vyXob8Z0wtraAQnoDn2UmGpLYLSDMQi9 FXl8pEPbJIeo9YDJUxCwXB+Oakc5HkJSeQy2RJS8/iB0mK4VX1DWJs/qU9WWAlgxJ1Lb rdKmwxNoT4IBSsidS4stT5UrdafKhLBV5oswNgkUSnMaD2bneXnvKfg58HfJO5JC7im8 0ZklPFHjsNrUa7AlB9ATMfSEPHF2XjZzxNd5MhHt8xWNWl445yxBjHSPmyDchV+U/Ukn r4oA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=dEmcFfwz2L+StBJeb/XI1q11MxS9zvrjcdaPS4MWOrs=; b=VieKP8J8MRPiAOm0CU0v65zTvLI+2iAIOOMjioIqaNCO5FJXBQZx8uLbvhjNkQlJx7 hBjNb/n1M11V712BgbjWEQPuxYTj7o6mVHX8Un+6ff5+CjO4eEB2NeFvc5iW0zFiURV6 6X0Wkx9GOLJVc/v4Hh9TFA2Se2Hug0jYD/KEOP8Bc5ycDrsGKlqp0TNjIvx8HAmNNo++ 61VvwixOK7TQUAEYQEEXIRVSeRt5oAirV4yza08KXEUHDels/PF+2dgkk57lLzuAPJXg skDQTMjT1CFbsQGegjwu+bBG9hfjnHYplxRToKyimSFlgiYrgsrBYnXS+e+kg+AJDDgt LY9A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t14si4842031ejb.435.2020.08.23.02.05.53; Sun, 23 Aug 2020 02:06:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728651AbgHWI5O (ORCPT + 99 others); Sun, 23 Aug 2020 04:57:14 -0400 Received: from mail.zju.edu.cn ([61.164.42.155]:24282 "EHLO zju.edu.cn" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726231AbgHWI5O (ORCPT ); Sun, 23 Aug 2020 04:57:14 -0400 Received: from localhost.localdomain (unknown [210.32.144.184]) by mail-app2 (Coremail) with SMTP id by_KCgBHF7xSL0JfbI8cAg--.24790S4; Sun, 23 Aug 2020 16:56:53 +0800 (CST) From: Dinghao Liu To: dinghao.liu@zju.edu.cn, kjlu@umn.edu Cc: "David S. Miller" , Jakub Kicinski , Heiko Stuebner , Caesar Wang , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] net: arc_emac: Fix memleak in arc_mdio_probe Date: Sun, 23 Aug 2020 16:56:47 +0800 Message-Id: <20200823085650.912-1-dinghao.liu@zju.edu.cn> X-Mailer: git-send-email 2.17.1 X-CM-TRANSID: by_KCgBHF7xSL0JfbI8cAg--.24790S4 X-Coremail-Antispam: 1UD129KBjvdXoWruryfCrWrGrW8GrWfKF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ux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When devm_gpiod_get_optional() fails, bus should be freed just like when of_mdiobus_register() fails. Fixes: 1bddd96cba03d ("net: arc_emac: support the phy reset for emac driver") Signed-off-by: Dinghao Liu --- drivers/net/ethernet/arc/emac_mdio.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/ethernet/arc/emac_mdio.c b/drivers/net/ethernet/arc/emac_mdio.c index 0187dbf3b87d..54cdafdd067d 100644 --- a/drivers/net/ethernet/arc/emac_mdio.c +++ b/drivers/net/ethernet/arc/emac_mdio.c @@ -153,6 +153,7 @@ int arc_mdio_probe(struct arc_emac_priv *priv) if (IS_ERR(data->reset_gpio)) { error = PTR_ERR(data->reset_gpio); dev_err(priv->dev, "Failed to request gpio: %d\n", error); + mdiobus_free(bus); return error; } -- 2.17.1