Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3515791pxf; Mon, 15 Mar 2021 11:15:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxWaq5JYeCM30unBWawVBiqsgtC26KU3Sf27mBMsHUdoBW7BpKqzpiCqowpx7Kci3t2/4Us X-Received: by 2002:a05:6402:8d7:: with SMTP id d23mr32164270edz.256.1615832147697; Mon, 15 Mar 2021 11:15:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615832147; cv=none; d=google.com; s=arc-20160816; b=bSzylZ5JZEZPYltAOu9G+RSRqMTS1PIzPjH0+yCfjcmsgKjcBo9zY5sDEsCG6GijCH 3vjnU7eRejn16hH/TKG1wKt2pNnYvsfxLshuEupf3PgoYyY8fc9Wa/XZ4gAtLZafrXSb MKoV+KIGpL5ESYm29BD3UMrJjR3bmw4OajGRJNih5wFCMtFE08LjMR0vfU6GECfNrC4C 2Q8TD64VTaC+xEkLTzWljXoa/xEAOLCfoavdgV0/q/QMsQSYAMxZXxKVh2y8VeA3JepT vpxAnX4LWQSfxUUjPxtp4D3CZHLZ8Q4Qw3r/f6PHM7v1RnVqGZWHuCyEXoRte0sNttxD giEg== 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=ht+hn7RbxCSFX+Q7ZGHeyXVfdVglw3ORoNwbFk0n3L8=; b=0z38P3gGxdxBGUfDw9lFGSKatumwGtvLMzXIarCCvyY6/Ewpb/WXENHtxMBgyi/Wf6 mvWQW2dJaL3hcMCN5U79QVSAFkCaMCWPqjoCRtK/QIe8joA4U4OnKfBykQQKL8BIZ9j1 RmGSJKwQtbCRDNP85d0QYhE65nV6QlVjGm5C6fd43z3ujUrVSmxMhGxOfbCJD7+hX0mG 5H1VVA0WYcNrW/EUQuXnanUqsvqKep1DJm24ohiry+QC62cKQF3AQNtU42F4by83OYFB FY2vO/trvHGun9ivUft1yOBly3rTFnKQfbS3T9IPWwv7/Dg/5jKh1dEMTYfXDhLVodtE wikg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=FHCJbh08; 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 f16si11844002edj.210.2021.03.15.11.15.25; Mon, 15 Mar 2021 11:15:47 -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=FHCJbh08; 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 S236424AbhCOOM5 (ORCPT + 99 others); Mon, 15 Mar 2021 10:12:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:37820 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232477AbhCON66 (ORCPT ); Mon, 15 Mar 2021 09:58:58 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 137E164F2E; Mon, 15 Mar 2021 13:58:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615816720; bh=BTX0qJ3n6SIdKilulVAPZ2yySWm99XSe9dgXJ1gFNWs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FHCJbh08b4YVsVqfMBGc9tetU11O01DNcnOO2Mg+1NzZfbGP/o9ZinGb2fKA3SbqH rvvTYlByJwdDGvO8dwwHYAMus7UCvmpgEuL+4oJOFeQmIv/jivqXeurxCCHL/Dn8zE p+kuF3pHdKRSgVSSfRBUIOREOnWYsA1HTP3wprWY= 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 4.19 026/120] net: davicom: Fix regulator not turned off on failed probe Date: Mon, 15 Mar 2021 14:56:17 +0100 Message-Id: <20210315135720.850938915@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210315135720.002213995@linuxfoundation.org> References: <20210315135720.002213995@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 @@ -1460,7 +1460,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 */ @@ -1472,8 +1472,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 */ @@ -1716,6 +1718,10 @@ out: dm9000_release_board(pdev, db); free_netdev(ndev); +out_regulator_disable: + if (!IS_ERR(power)) + regulator_disable(power); + return ret; }