Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3514564pxf; Mon, 15 Mar 2021 11:14:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwhN42bhzCw1HP7nuJy5navWehRf8ntNYBE9DxsKFmx6vOxue0w2OlCFycji4Crsz+UdFWn X-Received: by 2002:a05:6402:1393:: with SMTP id b19mr31427871edv.333.1615832047647; Mon, 15 Mar 2021 11:14:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615832047; cv=none; d=google.com; s=arc-20160816; b=ec7vRYsRmZ91Y98v9f7AtzpCJsgEnRzSgKbSxypzPiFKfKf8DE+qRSMef/HHxEhuAn CvKi7xPFtobTi7cu8EThhhjz8uUQYLYtjV56TFTrzOeyrKgJ0krK/5nejslThPuojuFa ANrEOXQw7u/BmptFNTyAZic4F5j7LMbTuvkvUuMBzSqSA1kWrLl/lY3QK3WmDEyubx65 VnBBwBsmPuiP49+NXJK5fHXKy9iTFX5kA3akaI/AvEAla+m4ay6ZByhyE4xJVOqw5k9s E+aq75rKu/qpn4xVG7K8pWk6xB2U0OmMLdRI20lUk9YlJa7L5/W47sVXkzGp3aRI7u+m XFzQ== 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=F4cVm5tQRzIJqv0OmeRxXjgQmPI4NF2gdprulNvJaNM=; b=aE+io/sKIyC7jlmKpDd4cUV2WsFniSzkmPcjDHqdkWeWI59tOeVql8VTjl5epRdgxw QlAttuSbhOxRDUwOstFKBPY/z1Mfyb/5ELwYWjQ1qIAAbc9CSnUOWyA+sDdw6lL7v8HJ SBcq9bWsi/E3/bF6Ks/yH1vif3PYdwreHXbI0fKNQBr6jNZOzdDWbenIonSUXAEFFWZO 6l7UcWXyVC7IP5kIlgFm7/cQmd5cPcnkOHu0d3Rrn8O/6DhcoNs23GIDT+t8anA0xD8M YjD7gWwuY8mzooEA/dh7qUNhFslsJ/qREafuCH3HZeiT5bsTG9hYk0OCm/XGvlR0uvw3 c+HQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=y6UMGHOq; 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 g14si11625759edr.362.2021.03.15.11.13.45; Mon, 15 Mar 2021 11:14:07 -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=y6UMGHOq; 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 S236405AbhCOOMy (ORCPT + 99 others); Mon, 15 Mar 2021 10:12:54 -0400 Received: from mail.kernel.org ([198.145.29.99]:38284 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232489AbhCON66 (ORCPT ); Mon, 15 Mar 2021 09:58:58 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 9E2BC64EF8; Mon, 15 Mar 2021 13:58:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615816721; bh=mK0tMNh33YcS0r2sDesU5oGkBtHFM6Cp/KDQ9bx6s/s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=y6UMGHOqNNpacRiIwIBtSKQ1TvVdl96kILAvHFJUI1P+DfqgukxO+/mPve5yylige 8ZtM1jdso8z0lLt1bVnLEeBgnrZj9mQn5e8DoJpvkufT1PUhZupKq72BUfJnZwLB7l ntJuQ69kxCaQr2gVi37Kz/MwuKwOIuiL+r45CviU= 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 027/120] net: davicom: Fix regulator not turned off on driver removal Date: Mon, 15 Mar 2021 14:56:18 +0100 Message-Id: <20210315135720.883098020@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 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 @@ -143,6 +143,8 @@ struct board_info { u32 wake_state; int ip_summed; + + struct regulator *power_supply; }; /* debug code */ @@ -1492,6 +1494,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); @@ -1781,10 +1785,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;