Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3324211pxf; Mon, 15 Mar 2021 07:09:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzv8YWcBwWYwGE26NsOtxkTeLG9iS68OVHJUyFvE3CoRbWaWOby7MV/G3xvTYQPvXe5No4u X-Received: by 2002:a17:907:d10:: with SMTP id gn16mr13022674ejc.304.1615817363444; Mon, 15 Mar 2021 07:09:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615817363; cv=none; d=google.com; s=arc-20160816; b=apRtO0gxvgelxU0lBDM6rf2XSwkaa2g/Eue6adTt9VIA4DXvW2XceWA5cOYOUEojcp 2897XXj3DIEt8GLfxLCeMNl1h2XFJVm37qWodT+NrWJpEg7Mtmd+pkhjnx8ycMUckc6x m4culHjbbIW1JBlwsKz1KyZ6iKa+WZ8AscFWysoSYRCUQcWO/U7fcstmBvwSo9+XWClX Mzs12jgDflY16dEmaUOKRSBZhN+K35l1gTDfZl2X12wOt1ngUr8bKBKZjO1B2qQoHPnv 7fjuyeEVPmRjMi78b43tekLhWX6k05vCQdz98FyJ60IaxIp3tIsjyR3zhXPDzy1rI7Uw JdrQ== 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=5x8OokCym5q3I8LYXlWxakNfsp3eTsQZtBHU1a/kk6w=; b=BQeG7Su5ocf9xc6xrkN8KKSrb/T+Gylvpfpb8RRi1zUVrxrlEn+9gCuzU6dfUCrPqK +e0Bz7Ry6pL7+yCNP4WBcEUsNOUGBB17zDzM9UDGM7zP6OheujzdzSHbMqZiXJ0HrvfK C5E5wzapRKuTUjCLCaxtSzEUnJGBSNxnBH0TNMN2YJa43hRR+WqdrY3WbS8nPCi8y6Dw iM+YusLIh3AjZW+LYaOMEsKUfIKOf9vCy+4lDfmaaTl/4c8pbwHrzLzHPI8S4blEqxc8 MuwwBoCSE2fjyWQGW8jnbmOvFlgAwD8Ektbe/eK5n5CG2H838IYoqX98RT7R9oIJUcGq Vdsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=HDvgpowI; 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 hr7si11034514ejc.596.2021.03.15.07.09.00; Mon, 15 Mar 2021 07:09:23 -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=HDvgpowI; 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 S235298AbhCOOH1 (ORCPT + 99 others); Mon, 15 Mar 2021 10:07:27 -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 S231759AbhCON6A (ORCPT ); Mon, 15 Mar 2021 09:58:00 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id A728864EFD; Mon, 15 Mar 2021 13:57:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615816668; bh=ELjwP/jwcHd8mrRlC8sIWye42NMT0i7kSsJeJ66LizE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HDvgpowItMZ7D4Gpwf+Mfl9GHlQzsX5Ye3Samg6fUiN3BlvJVEM9cxJy0kFIZ43oS F3dwFA0SdiUscGV6qGbA5reLJyDkCUUjapZ5nkypuB0oqaub/kx82zNghlZDueM1jU Q79UOr5SkzyvxjLY5qnU9ovyaubUyFATB6+TU/P4= 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 036/168] net: davicom: Fix regulator not turned off on driver removal Date: Mon, 15 Mar 2021 14:54:28 +0100 Message-Id: <20210315135551.526948188@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 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 @@ -134,6 +134,8 @@ struct board_info { u32 wake_state; int ip_summed; + + struct regulator *power_supply; }; /* debug code */ @@ -1486,6 +1488,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); @@ -1771,10 +1775,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;