Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp5624091rwb; Tue, 22 Nov 2022 02:37:48 -0800 (PST) X-Google-Smtp-Source: AA0mqf7LrzPpoVnTEaFfahcGTB2vHGqRS4Nqs+W/fkMOcBiT50VUPMrUVbQZGK0q3tLLZDcGOPfT X-Received: by 2002:a63:de4a:0:b0:429:983d:22f8 with SMTP id y10-20020a63de4a000000b00429983d22f8mr3113351pgi.165.1669113468354; Tue, 22 Nov 2022 02:37:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669113468; cv=none; d=google.com; s=arc-20160816; b=ZFl01nGnVlLD4nUKbkK58qSndo5iFnuxfEL78WrUwxQ9Ei8UGLi5a3+zPfqeyp/qoo 0N0BEBLYSQKVaeiuBpAsoMYFKDGPoe+ybZnNQvz6PJxdSn7QvQxVmS6yQxDt3zBVfWJI 81xyc5L7Y5u8VcOWnAEdrtQwiL08vCJgKGHirwepacM+uzTaFtjG6Cc7orZV/0n5j8kQ QxP/xlrrKf6ZySZtk2qTU3tXVrXXJ7P0pKHv73bqGo6vNAGArz6gd08wpRUh2Oud1/w6 mHVfDA7Ou2H8nWZqODS8ga9y3vxiNVE0RHNaski/llZq+Ul+soCjqup92vggBaZUGV/+ 2RIw== 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 :message-id:date:subject:cc:to:from; bh=odve09RDto8scYCLXQqRPgXNS5kP0CTaVqf4J0NAu/4=; b=Uvp81vQ/XfM5PUpHe4pplMM/7ZUF++v+rfjkED7jYo3eGibnnzSnVEf9JQ7vZX4Oop Ol4wNI3C9Bs5jX4/q+yHhJL7+bmJXagBzhP936Ut9TyNs7WpY+UP8NQZQd9gT/tX+yma XyynOUsbgLwU/RF9Nq+Xm9JEMpPobLBZvkbQ0XOFwcbG3UetOJknSAmaq2rFGsm+iOmA IljHwfnrApPy/KVp90l/7TggWjzrXTl7BumjyEnjebR4VqSmxhDEpLsaVZ072bz8Rg+Q 4dX8IDdAHABAy3u1lvk4hbciOlRQczbES9R6XJS8G0/8yHkqHbXJtATgmZJ2+SWQno8J FHHQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a3-20020a170902ecc300b00189240585a8si5385463plh.292.2022.11.22.02.37.37; Tue, 22 Nov 2022 02:37:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232590AbiKVJE6 (ORCPT + 91 others); Tue, 22 Nov 2022 04:04:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37384 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232986AbiKVJEy (ORCPT ); Tue, 22 Nov 2022 04:04:54 -0500 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E6A4CE25 for ; Tue, 22 Nov 2022 01:04:53 -0800 (PST) Received: from dggpemm500023.china.huawei.com (unknown [172.30.72.57]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4NGdc60fQPz15MqS; Tue, 22 Nov 2022 17:04:22 +0800 (CST) Received: from dggpemm500005.china.huawei.com (7.185.36.74) by dggpemm500023.china.huawei.com (7.185.36.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Tue, 22 Nov 2022 17:04:51 +0800 Received: from localhost.localdomain (10.67.164.66) by dggpemm500005.china.huawei.com (7.185.36.74) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Tue, 22 Nov 2022 17:04:51 +0800 From: Yang Shen To: , , , CC: , Subject: [PATCH] coresight: trbe: remove cpuhp instance node before remove cpuhp state Date: Tue, 22 Nov 2022 17:03:55 +0800 Message-ID: <20221122090355.23533-1-shenyang39@huawei.com> X-Mailer: git-send-email 2.24.0 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.67.164.66] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpemm500005.china.huawei.com (7.185.36.74) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham 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 cpuhp_state_add_instance() and cpuhp_state_remove_instance() should be used in pairs. Or there will lead to the warn on cpuhp_remove_multi_state() since the cpuhp_step list is not empty. The following is the error log with 'rmmod coresight-trbe': Error: Removing state 215 which has instances left. Call trace: __cpuhp_remove_state_cpuslocked+0x144/0x160 __cpuhp_remove_state+0xac/0x100 arm_trbe_device_remove+0x2c/0x60 [coresight_trbe] platform_remove+0x34/0x70 device_remove+0x54/0x90 device_release_driver_internal+0x1e4/0x250 driver_detach+0x5c/0xb0 bus_remove_driver+0x64/0xc0 driver_unregister+0x3c/0x70 platform_driver_unregister+0x20/0x30 arm_trbe_exit+0x1c/0x658 [coresight_trbe] __arm64_sys_delete_module+0x1ac/0x24c invoke_syscall+0x50/0x120 el0_svc_common.constprop.0+0x58/0x1a0 do_el0_svc+0x38/0xd0 el0_svc+0x2c/0xc0 el0t_64_sync_handler+0x1ac/0x1b0 el0t_64_sync+0x19c/0x1a0 ---[ end trace 0000000000000000 ]--- Fixes: 3fbf7f011f24 ("coresight: sink: Add TRBE driver") Signed-off-by: Yang Shen --- drivers/hwtracing/coresight/coresight-trbe.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/hwtracing/coresight/coresight-trbe.c b/drivers/hwtracing/coresight/coresight-trbe.c index 2b386bb848f8..1fc4fd79a1c6 100644 --- a/drivers/hwtracing/coresight/coresight-trbe.c +++ b/drivers/hwtracing/coresight/coresight-trbe.c @@ -1434,6 +1434,7 @@ static int arm_trbe_probe_cpuhp(struct trbe_drvdata *drvdata) static void arm_trbe_remove_cpuhp(struct trbe_drvdata *drvdata) { + cpuhp_state_remove_instance(drvdata->trbe_online, &drvdata->hotplug_node); cpuhp_remove_multi_state(drvdata->trbe_online); } -- 2.24.0