Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3511198pxf; Mon, 15 Mar 2021 11:09:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyLejP8xljZvkEqBm9rel0ww+1qlb5iJ8edQaX3VZueiBhRQWWYcCHKHM13OPAgzqYJOmlG X-Received: by 2002:a17:906:1d4e:: with SMTP id o14mr24161579ejh.549.1615831761193; Mon, 15 Mar 2021 11:09:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615831761; cv=none; d=google.com; s=arc-20160816; b=ZIWBueS/pw4BZ8IWW75Fkkrsgc496Bs1o6pHmnpFpJpm35iP7HCN6qADpudFjYh5t2 C/EMcjQXwtQRCDyCqBTYi5VYOwccCMqzDCReeiv4/0pfrqxtIq6Ax5wKHWENK52Mmi3u ULZg4OdiQpKUj1jy1ZcDu6+Ftrbt0v2sa7b1QI3krWFXPyhORHc2y9tektnt5u7hFAca vI1c2hNTorohVzhehFLa6PwA87wpEMn3PIzp4CY1zTI+1dDryVfrMi8S1iYg5VjWI0id klZZHXD3LgA0v4YCJfj0cJkT40e2HAkRSmMorODPviRh+dReMNdjqH70B9t02RaJuSaq nOzQ== 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=GJ9jIrtQrAOBEAZ1C1sAJM7RBFvJZvZJ7hHTRbwFIrQ=; b=SdAxef4Q2uVXuLyVuwY0SGg5SFYvcm3yoEr/Il3vekWgLKssUI1i7YIxroIUh3/YgP MIOcS4uVamphx1wyJRGHJBxzUWWeGmE8Z+a9bZc5Q00ImcYBrlPgdeTSAkYMP70mgHtd VrfGsRwckqcxNXb67Q9dz+lu2mSQlC1tjYIK4RNAKRgdVv+g1fQSR8LjL+8VOE4bkOu+ Jy//soMhW8zviR8RSG0IxstXDihW/5Y6rIwAoio2VOziOmrjKth/U+msmQ94uRdbpocX B5Bj+RCpf1v744NMsPc1lV9xmzvK/yk6PYdlsLIKlN0hqBqUPvCaje4KfMoXxf/ciwjp j8MA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ucoxnC04; 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 w17si11325433ejk.520.2021.03.15.11.08.52; Mon, 15 Mar 2021 11:09:21 -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=ucoxnC04; 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 S234990AbhCOOJe (ORCPT + 99 others); Mon, 15 Mar 2021 10:09:34 -0400 Received: from mail.kernel.org ([198.145.29.99]:37670 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232248AbhCON6P (ORCPT ); Mon, 15 Mar 2021 09:58:15 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0A4E064F00; Mon, 15 Mar 2021 13:58:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615816695; bh=Ov6u9T/JWMCotOW2MjbG0C0kwpWxaSG1R7viYH1j3pE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ucoxnC04E/KyfWSAiR+SKer5TKBuxjrFj6p2IfcUTd7FGX20ZSpriVSCXFIq27q2/ n5MTCCoGiCkr0/mt3njTkGiCR7uVrpG6jtnCxIc4tHCJOXgsXtInEkESimVD8rbmOn 4L3bekWHuErPE6S5JQt+bwG4H4dj2XECV+720rSE= 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 069/306] net: davicom: Fix regulator not turned off on driver removal Date: Mon, 15 Mar 2021 14:52:12 +0100 Message-Id: <20210315135509.980665286@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 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 */ @@ -1481,6 +1483,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); @@ -1766,10 +1770,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;