Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2193228iof; Tue, 7 Jun 2022 22:46:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxBczkmwTxTjL63F/A0HRkl2Wrkpc5zt6A2TupgRcvRxPMWWK0SPzc8DdXjJ6JiRltVu1Sr X-Received: by 2002:a17:903:22c6:b0:167:5991:fb63 with SMTP id y6-20020a17090322c600b001675991fb63mr22229523plg.37.1654667204014; Tue, 07 Jun 2022 22:46:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654667204; cv=none; d=google.com; s=arc-20160816; b=BXdkmMLnKoN8EOQTA10kuu5jz4pqyr53K0FK8WBxAqsn9ch8VSG3aB+Y6BYm3EFvkm 7uIBKtfK2KJNTNC+zEKSohgauVcfMcgFOAOijHiw/FyHSnDuGori37VxLGXWZsyp2AIC NzY+gb2x63dHwIB7bZMtFgjJUthzqa4C5OikGFRsEPOy6I5Kyt5W+uLd1aLgE5PVFQ0a phA5RaoRZn77DcesGmuNYsxj4cGUY4gb7T4jc52MGj2Xl2CkgQqWBrGfHFosvvCHXrac 3aeneXj/4YAs8W+03IEhPp5pCRcw2/RsjZV0veepUt6Ai8y3HaJllpF7VOzp13naZo3b 2o9w== 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=u7VHamjAW2VUnlTiKFRNiyT4PQKkaiAFKYjo45wtD/c=; b=xQmaQbZxhopb7n7WBrpi7m3Xl9QKxamgrsyHVnslCsqF89oUXzJu9lGvsERded6C0u c6aqSL+/PGTBeJ0rPfSMuUt4RCbSFig6sojSIZHWZWOPwi7TVESkJg8bwpwacW6V5qQS JG9bWVS4c0sFTNwpoZhoOYmB0gnKf8XboagnL++PDaSbCC24BbZI6aYhi42S+urujpi2 uQq0iWQoX/G9EH1jj4HiOPNotavJ//hkXjaXU9uD+HuvkqkfVtadoqIeYKJIH6CQBz1M BVK6OvEjvbdzoksIWg0ZYLhWfDvxrskjmTcavECLe4FNEdo5va03lWBiQrnF5oP+s+LZ k+iQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=yk2aeMDk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1: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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id l4-20020a170902ec0400b0016179fd2770si23472146pld.392.2022.06.07.22.46.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 22:46:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=yk2aeMDk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1: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: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id C82292A25F1; Tue, 7 Jun 2022 22:11:32 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1385460AbiFHAVX (ORCPT + 99 others); Tue, 7 Jun 2022 20:21:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40030 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1383095AbiFGWFR (ORCPT ); Tue, 7 Jun 2022 18:05:17 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 464AB195945; Tue, 7 Jun 2022 12:16:29 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id B338FCE24AA; Tue, 7 Jun 2022 19:16:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 92EB1C34115; Tue, 7 Jun 2022 19:16:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654629386; bh=bztlmvwcCgpEkjqxhJVwCHE/RQIR8mjqYy01g1meIeY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yk2aeMDkrFZb3lIaQiYm6jGwxUODbguSIDH6zhrsCdfEgLbMhMpTSuCMpOLQnflpB zfrqz7SgA5OwRmOsRPaNYndyvwRSRBl68p/OkLDXI0jxmQ7c1D4TlG0AvZdGMeK30D 8tiW6pJo6GczIv1yWNjtME6xh2WyvdL6b5FFr+us= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rex-BC Chen , Viresh Kumar , Sasha Levin Subject: [PATCH 5.18 670/879] cpufreq: mediatek: Unregister platform device on exit Date: Tue, 7 Jun 2022 19:03:08 +0200 Message-Id: <20220607165022.298206332@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Rex-BC Chen [ Upstream commit f126fbadce92b92c3a7be41e4abc1fbae93ae2ef ] We register the platform device when driver inits. However, we do not unregister it when driver exits. To resolve this, we declare the platform data to be a global static variable and rename it to be "cpufreq_pdev". With this global variable, we can do platform_device_unregister() when driver exits. Fixes: 501c574f4e3a ("cpufreq: mediatek: Add support of cpufreq to MT2701/MT7623 SoC") Signed-off-by: Rex-BC Chen [ Viresh: Commit log and Subject ] Signed-off-by: Viresh Kumar Signed-off-by: Sasha Levin --- drivers/cpufreq/mediatek-cpufreq.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/cpufreq/mediatek-cpufreq.c b/drivers/cpufreq/mediatek-cpufreq.c index 9d7d9c8dc184..bfe240c726e3 100644 --- a/drivers/cpufreq/mediatek-cpufreq.c +++ b/drivers/cpufreq/mediatek-cpufreq.c @@ -44,6 +44,8 @@ struct mtk_cpu_dvfs_info { bool need_voltage_tracking; }; +static struct platform_device *cpufreq_pdev; + static LIST_HEAD(dvfs_info_list); static struct mtk_cpu_dvfs_info *mtk_cpu_dvfs_info_lookup(int cpu) @@ -547,7 +549,6 @@ static int __init mtk_cpufreq_driver_init(void) { struct device_node *np; const struct of_device_id *match; - struct platform_device *pdev; int err; np = of_find_node_by_path("/"); @@ -571,11 +572,11 @@ static int __init mtk_cpufreq_driver_init(void) * and the device registration codes are put here to handle defer * probing. */ - pdev = platform_device_register_simple("mtk-cpufreq", -1, NULL, 0); - if (IS_ERR(pdev)) { + cpufreq_pdev = platform_device_register_simple("mtk-cpufreq", -1, NULL, 0); + if (IS_ERR(cpufreq_pdev)) { pr_err("failed to register mtk-cpufreq platform device\n"); platform_driver_unregister(&mtk_cpufreq_platdrv); - return PTR_ERR(pdev); + return PTR_ERR(cpufreq_pdev); } return 0; @@ -584,6 +585,7 @@ module_init(mtk_cpufreq_driver_init) static void __exit mtk_cpufreq_driver_exit(void) { + platform_device_unregister(cpufreq_pdev); platform_driver_unregister(&mtk_cpufreq_platdrv); } module_exit(mtk_cpufreq_driver_exit) -- 2.35.1