Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3513643pxf; Mon, 15 Mar 2021 11:12:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxn/jGWaVDwQ+hWQIlAAYMqgA6LooBtmJCKKgByVcbaG06lRhE6jBAxKQxWgCnB0x4jFQ0A X-Received: by 2002:a05:6402:2070:: with SMTP id bd16mr31213410edb.133.1615831974022; Mon, 15 Mar 2021 11:12:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615831974; cv=none; d=google.com; s=arc-20160816; b=ES1qiAfGjze2j4gfva545Fh9OexDA5mmwmAlXGWzkv9C2GfCmfr78qWEPYKtDIDari MPob9hdOg+SI8p85XuFYDQAc+WvdTTEwYcj0YIGFMOiv7ZnokDdSHSih5zDYpexRc0gS lqk8hF9csrUNK9B4otGKGW69gxmwnuZ8fhPmkZd+kv+ZsLiRwoS2we8GF7k/s8h95e9N voTNkKn5NhVM98jKm9J4wItAqRs5XqEJs43PI9AfQxrKRM4vVcP6Dv45YL/i0nT+V05m iHzb99VSeZBppF1lhXssQeisScRUFwkZIawu8jz4w6HLEIVMRWYTsJFNFbZI8Xr6MTmk coYA== 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=OGQRxGS8YmaGzpE+5Iszxn7c/oPziXNozVAJEgZfVzk=; b=tU6iQyKaSdVfWYZ1LIjcZ1veTVcDXHRKeqgef7y69eSAr+nL2fEBLEpSF0Ia32eKus UdNQqhNzJOdtjCXjNkPN04jotI1EZ55RET1pzxhhlQB1Uz+CJ7T3wJW+UOL9f1YEwMsI Cu2Kq8z+cYZ/PyTZq9qq7XPLCILdcFP+6fxAh1HW1T+aw14N661p5rR18EEpQjIWT2sD f/uiXabb5z6CrrXnEuv/lV6Bs9g+7oIfozGL2Q301GbceE1XTXj6Sr9b2oN8/MkH0EYA mIMdgRQJN5aQEucp72lZ3bO7U0D66+yqM6vscmXZpJGK9JDNz8f89JvIqXyi3IT0jq95 PaXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KDxznJcu; 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 bi6si12338508edb.419.2021.03.15.11.12.31; Mon, 15 Mar 2021 11:12:54 -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=KDxznJcu; 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 S235790AbhCOOLQ (ORCPT + 99 others); Mon, 15 Mar 2021 10:11:16 -0400 Received: from mail.kernel.org ([198.145.29.99]:35186 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232192AbhCON6O (ORCPT ); Mon, 15 Mar 2021 09:58:14 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 919D064EFD; Mon, 15 Mar 2021 13:58:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615816693; bh=wfa4Zzvh/uVX/iyUOvyyCCe/3AtpxaNDV/qy4p2Yfnc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KDxznJcu28EZzNR7J4YTMXMtag+ok+JA7snFHMvkA7PXMvAKF6UUijT5kq/BSnLR9 I+wGizQLcBzbT36fCjiD+bu9efeFg7GTzbnFIJAr7Kh7MYrmX7IIrePPjoFR/8rct6 H7z/iMPEGJ4j69GI0XaCcl0GbYL+qrs2oTQCQjf0= 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.11 068/306] net: davicom: Fix regulator not turned off on failed probe Date: Mon, 15 Mar 2021 14:52:11 +0100 Message-Id: <20210315135509.945846089@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210315135507.611436477@linuxfoundation.org> References: <20210315135507.611436477@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 @@ -1449,7 +1449,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 */ @@ -1461,8 +1461,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 */ @@ -1703,6 +1705,10 @@ out: dm9000_release_board(pdev, db); free_netdev(ndev); +out_regulator_disable: + if (!IS_ERR(power)) + regulator_disable(power); + return ret; }