Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3326247pxf; Mon, 15 Mar 2021 07:11:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyq04FM85WSMi2YqgO/OiWmndgrOhbz1XEWuqwO33fQ2HKa0w8IVjQjOA2CeVDzLOjrZmXk X-Received: by 2002:a05:6402:1d1a:: with SMTP id dg26mr29764731edb.266.1615817501246; Mon, 15 Mar 2021 07:11:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615817501; cv=none; d=google.com; s=arc-20160816; b=xV4jq8Zu9zeg5MN9UKyEU6YV8uku1JO2uopmslF0pO7t+XUe2dBchFgjnFlyVG+kkT y2fqy+1OODLL6N0cvQ+pLCa/G9VpyR9w+z+9bia0TQoUquijaYo9AKBgIMrmAT2iM+iD XTBq6U/Nk1ffSHpShG2qtzUmP517BfT+vjqKSrHjZTQpyDIjfJ40KxkxU4dyLJgmx2GS ZusIjNufuUBCBkGroDeTgGO92CaOSG9IOoweufC/UDR52dV8myWyhc6XD03wavfbl0gm Ti/4l5nXyeTVn/aSyeL3wNvAgvyIEXYxUGPuOt8gJwRUugbUnfZIbPiIL330ajZ1zpzn kk4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=zxPT6wDqjGk/TzqkyRA+Aa945dF3fbRZl4sfVW0LyV8=; b=FuEfpetYfYetRfqXdAm78c4XHCNvNpW4r7N5JmIFAVl2SmzYDqwMKP3EZUqsBWpkg4 fwA72N/xScFaGrvP4pLKC9+/D5QKjxL6ibZ2n3Ftt5V89fexcQpPI3j+yEQEzbjSFyLm JWnERiuwM5pDK9AZp3WzewXsLMAzb4KOc+QFLxBsn8bKgDUAZjYiWuI7nADeW3KEF2Mv /77PWP21LNB0njKsdL7tQH/4I1rsHPf0NDiuFNZ9NeGEQ6uQD+fC9HBq73OljHwSzSvC vgD08zhJyuSyEQt4fgIY0xsbcAO8AzZzxfSdaFkmiNgn+kJZsXCgzFQkrhGUdo3WciI6 ppSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lwDWvt31; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m13si10466370edc.258.2021.03.15.07.11.18; Mon, 15 Mar 2021 07:11:41 -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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=lwDWvt31; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235502AbhCOOHr (ORCPT + 99 others); Mon, 15 Mar 2021 10:07:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:35420 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232153AbhCON6K (ORCPT ); Mon, 15 Mar 2021 09:58:10 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id A074C64EEA; Mon, 15 Mar 2021 13:58:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615816689; bh=tnvY97k84FCuZTlndV/VfCQ55IreuQGDDrGmasdb/Dg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lwDWvt31csbJMlVnFZDdPxsJwLapKrRT8fw4JUmLOcMq+YgZyLs6e28wOe5a//ZM8 hpjaeA8gRSxNtdWKtwyt+sE3Enr8NgMNwmgBUAjIeMCYwitdWW9GK0V322+L3ukMnJ 4Z8izFgZWbBp+W1UicL5v1DBLm/KNvTCgOOMTdYQ= From: gregkh@linuxfoundation.org To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Paul Cercueil , "David S. Miller" Subject: [PATCH 5.10 057/290] net: davicom: Fix regulator not turned off on failed probe Date: Mon, 15 Mar 2021 14:52:30 +0100 Message-Id: <20210315135543.857813815@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210315135541.921894249@linuxfoundation.org> References: <20210315135541.921894249@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Greg Kroah-Hartman From: Paul Cercueil commit ac88c531a5b38877eba2365a3f28f0c8b513dc33 upstream. When the probe fails or requests to be defered, we must disable the regulator that was previously enabled. Fixes: 7994fe55a4a2 ("dm9000: Add regulator and reset support to dm9000") Signed-off-by: Paul Cercueil Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/davicom/dm9000.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) --- a/drivers/net/ethernet/davicom/dm9000.c +++ b/drivers/net/ethernet/davicom/dm9000.c @@ -1452,7 +1452,7 @@ dm9000_probe(struct platform_device *pde if (ret) { dev_err(dev, "failed to request reset gpio %d: %d\n", reset_gpios, ret); - return -ENODEV; + goto out_regulator_disable; } /* According to manual PWRST# Low Period Min 1ms */ @@ -1464,8 +1464,10 @@ dm9000_probe(struct platform_device *pde if (!pdata) { pdata = dm9000_parse_dt(&pdev->dev); - if (IS_ERR(pdata)) - return PTR_ERR(pdata); + if (IS_ERR(pdata)) { + ret = PTR_ERR(pdata); + goto out_regulator_disable; + } } /* Init network device */ @@ -1706,6 +1708,10 @@ out: dm9000_release_board(pdev, db); free_netdev(ndev); +out_regulator_disable: + if (!IS_ERR(power)) + regulator_disable(power); + return ret; }