Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3509549pxf; Mon, 15 Mar 2021 11:07:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyyr9h6ubMFcdIWkJqeMN1VoL7iA9qhFE0APW6yIW6CNQFnNP3g0THHxdR4c14DoJBvAVzC X-Received: by 2002:a17:906:11d1:: with SMTP id o17mr25284815eja.517.1615831631725; Mon, 15 Mar 2021 11:07:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615831631; cv=none; d=google.com; s=arc-20160816; b=lCKqHR1K/jwy0icG0I1k6m4v8xCkbzzMdcY7ZAGn9eS4HXB8gURdA6nuJ9kq058eOt Ypp+u95qJiGd7uy01yPZT5P8drmboJ7SPRh23AaYErBTDbtINe64COECfmskdWV/Tphc 08H2uwmPNgzZGRI2kcUWSj3K6SFcPUpnHDL//MhHAIZ8OLvg9y46jtdoZbAZywref3M4 875ntmPcUIEZC0N94BmvD90jOCedhYIpFI4fyyqyW2JWyED/5dDnBxWskJJe1/p7UYh1 lPnYMlu2XyB6eMa9XE2jcURf5tqXKKg7+tWjgq3zaXxU4xDid3SPtlNJp8BAuAw5vdWu 4ENw== 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=fdIB2gy6brFVZCZW8QuWu6qBEpjs4SCVnPDBLxVGhx8=; b=hQQeOii7XWoX5T3ITSww5WuCm9umf8+Bg0erNPQ51UQC+SlN2HLxmm4d1khT/GMJzZ N/PF1SXURJur1SqEzfyNErSIiiJAJQqMIqie3TJ+clolQL/7JATdSsE4ASNFohdIJlBS 5nc9v7GIu2+jBvKLbwLfRPJgjC/PRIWc5D3Sxni+wBkTygUK98UHqm7U3mcNF/lPWY3q c618eBhl4hP2iZtzVhOIZVO+rVzb5wVflRKRRbMSapPIoqgiNagy0o+SlVEW0xi59xWs YZI14VRhVA1PeXknnLHpIBGLdqD9R9BwxYvjBFDKbetEbrm/E4K/h2HaPWtaqMzm+Dc8 GE8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=t7hdkeXD; 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 hp15si11634332ejc.548.2021.03.15.11.06.45; Mon, 15 Mar 2021 11:07:11 -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=t7hdkeXD; 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 S234040AbhCOOIB (ORCPT + 99 others); Mon, 15 Mar 2021 10:08:01 -0400 Received: from mail.kernel.org ([198.145.29.99]:36614 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231963AbhCON6L (ORCPT ); Mon, 15 Mar 2021 09:58:11 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 1CE4764EF3; Mon, 15 Mar 2021 13:58:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615816691; bh=tYSdTe9f5PAfyzjM2SfTZ9mZHdnLcEFsZevT8lD/CPU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=t7hdkeXDYJpinUuO/1KqiSOqUeJSiLWMBJVrakJ1/5ykmTQdAQzeJCSNxI8ASnWyo MZ4QfdAN/tKZDFOaWeqhCe4SiDj80e5Y80yMX6iUUWkJa8qAQ0Lrb2+4er7NNC1zjr VR7n/YbIiuhmyxfOuPaXm3EUqEZ96OV38L34TEwk= 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 058/290] net: davicom: Fix regulator not turned off on driver removal Date: Mon, 15 Mar 2021 14:52:31 +0100 Message-Id: <20210315135543.888341058@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 cf9e60aa69ae6c40d3e3e4c94dd6c8de31674e9b upstream. We must disable the regulator that was enabled in the probe function. 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 | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) --- a/drivers/net/ethernet/davicom/dm9000.c +++ b/drivers/net/ethernet/davicom/dm9000.c @@ -133,6 +133,8 @@ struct board_info { u32 wake_state; int ip_summed; + + struct regulator *power_supply; }; /* debug code */ @@ -1484,6 +1486,8 @@ dm9000_probe(struct platform_device *pde db->dev = &pdev->dev; db->ndev = ndev; + if (!IS_ERR(power)) + db->power_supply = power; spin_lock_init(&db->lock); mutex_init(&db->addr_lock); @@ -1769,10 +1773,13 @@ static int dm9000_drv_remove(struct platform_device *pdev) { struct net_device *ndev = platform_get_drvdata(pdev); + struct board_info *dm = to_dm9000_board(ndev); unregister_netdev(ndev); - dm9000_release_board(pdev, netdev_priv(ndev)); + dm9000_release_board(pdev, dm); free_netdev(ndev); /* free device structure */ + if (dm->power_supply) + regulator_disable(dm->power_supply); dev_dbg(&pdev->dev, "released and freed device\n"); return 0;