Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3513093pxf; Mon, 15 Mar 2021 11:12:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzmcGUVyo7+wJeuUIJGGhsdReQyggAlBayN8YprdsAt1Lc5xUWvFQ0zpXlO6ny7dIITUzOM X-Received: by 2002:a17:906:eb4e:: with SMTP id mc14mr24527841ejb.169.1615831924352; Mon, 15 Mar 2021 11:12:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615831924; cv=none; d=google.com; s=arc-20160816; b=QBTX32Tb2MAX7hrVVQs6bAq1gWAyaVq+TwNOqTOVedYqmLBNGZEDyy8jFGi0vXGVb3 CGZ4GtuaunwxPLJrp3LGo52n/auSnPO15DYhri3WXR0asw8XU4hVNH3IcuVxS63o8ZnN xgZ8fAeACHdxe9A3REHc/RdAiAFycV0uVGzk4/CthvwiFBcxbtcuAmicKba3NM/hgrc8 CgnUyvNjiZftil8fQtCIAFTMtwM6+Ptn4TVAAlaL4e9NFV7iL2vjY/l+vrZtj6Duek2v jvxRJrcjS5ig46nownJv4gbWUqjeiusDnAkU8vrn52i27qwuv1qKYUTDU0OVRAhi2cQG UVwg== 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=N0DL+PmOZggORpOTQsFcxODbNplH+CPI7FP8Kxut5WE=; b=jLmGxBrTAXh2bQLBriFqHUkHjPkL2E4E6mGWTkyUrsEmwHtULia3xBGFKIzIlu8AZV 1Q1unzlDrv9TMA69mbZw3lGdTWFaeB2O0JTrNp6HSGZAnvf/FW5zsWqJfofkUhPqmmof cq0R6YB+csHNdG2sks68FKXmT3l3i0mw3Egl3lCLAN+LZQ/5BVey3wcHB7Y8Kxca64Ik QLuZGQxCR71JF/BKmQLyOHwNvUfiZWx6LeR41AZCXM+O7PpBmQvlmzkYUYHB5PRVC0c/ 5i77zt8LuRIXZQUgVYRk+Hl3YxA3P0Q0AOhdi/05pwy1qNwb6Z3dwUw8lmTl4IebIygU e/oA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xnvtjAph; 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 a10si11323379ejr.227.2021.03.15.11.11.26; Mon, 15 Mar 2021 11:12:04 -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=xnvtjAph; 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 S235878AbhCOOLf (ORCPT + 99 others); Mon, 15 Mar 2021 10:11:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:35038 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229746AbhCON5t (ORCPT ); Mon, 15 Mar 2021 09:57:49 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3A5F364F01; Mon, 15 Mar 2021 13:57:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615816667; bh=LueKkyeFRpowgjXMPWsJwNWmy+b2MfC9rEuDgZn/XFo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xnvtjAphcVVWaHr2qmw+o+3FdL6TMzHc3+p2e4Tdg7EeAx6vs3r3/TKCnLchBIrQG teN3eWGAFPqIgRn6wwwrEhIvLwsZGm4rFrRazOi7tNMatm5KRyRRpGj3LWBztPyMrJ 1Kbf+2BNnwA+9wQFUXChwnw0poWtHunejM5l9nVI= 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.4 035/168] net: davicom: Fix regulator not turned off on failed probe Date: Mon, 15 Mar 2021 14:54:27 +0100 Message-Id: <20210315135551.496322796@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210315135550.333963635@linuxfoundation.org> References: <20210315135550.333963635@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 @@ -1454,7 +1454,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 */ @@ -1466,8 +1466,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 */ @@ -1708,6 +1710,10 @@ out: dm9000_release_board(pdev, db); free_netdev(ndev); +out_regulator_disable: + if (!IS_ERR(power)) + regulator_disable(power); + return ret; }