From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 05604EE499D for ; Wed, 11 Sep 2024 12:27:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:In-Reply-To:From:References:Cc:To:Subject:MIME-Version:Date: Message-ID:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=rVp6wxd6D5e84CELJHA7K7LOJWXki3UFYHHEhFoI11w=; b=EPhds/ibuRWYID/dD/p0BXDZtv 0t3FFXOJOfgL2rwDcOH/rc4uPMGXdWMBkxZFZRPBeSEgbwTd4peyRiQJ2uCTQ7mht9YFVEruE8gKs UxGF0beBddU/0K9h0ZARBqRz35GfQaMyJpsuuNtl/NlSmm5669sIvIjy75WYZOE8x2nqMhMh0+tHW A2EoCUeZWP7H+9Hs8Djnz8DYAi2uj6qJrBC4h2Xm1rVtqyNch6gsa72Gdk3Dbui1g26PJ4keIYzmA /XqmI10I4aqz6awyL/oUqzFtvPplu7mMvy6lY2WoSB78lBJBz+FsYplVfi/4mFZ53TYI3LPfe9rhB /qDYtuAg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1soMRk-00000009TBL-0kIM; Wed, 11 Sep 2024 12:27:44 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1soMPp-00000009Sn8-0Mw2 for linux-arm-kernel@lists.infradead.org; Wed, 11 Sep 2024 12:25:46 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 0744D1007; Wed, 11 Sep 2024 05:26:14 -0700 (PDT) Received: from [10.57.76.6] (unknown [10.57.76.6]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E52CC3F66E; Wed, 11 Sep 2024 05:25:43 -0700 (PDT) Message-ID: Date: Wed, 11 Sep 2024 13:25:43 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [bug report] perf: Add driver for Arm NI-700 interconnect PMU To: Dan Carpenter Cc: linux-arm-kernel@lists.infradead.org References: <3ef9d6a4-bb08-4496-9d20-4781fa4c8e8a@stanley.mountain> From: Robin Murphy Content-Language: en-GB In-Reply-To: <3ef9d6a4-bb08-4496-9d20-4781fa4c8e8a@stanley.mountain> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240911_052545_201625_C2C60B6A X-CRM114-Status: GOOD ( 10.76 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 2024-09-11 8:35 am, Dan Carpenter wrote: > Hello Robin Murphy, > > Commit 4d5a7680f2b4 ("perf: Add driver for Arm NI-700 interconnect > PMU") from Sep 4, 2024 (linux-next), leads to the following Smatch > static checker warning: > > drivers/perf/arm-ni.c:726 arm_ni_pmu_online_cpu() warn: 'cd' was set to NULL > drivers/perf/arm-ni.c:738 arm_ni_pmu_offline_cpu() warn: 'cd' was set to NULL > > drivers/perf/arm-ni.c > 719 static int arm_ni_pmu_online_cpu(unsigned int cpu, struct hlist_node *cpuhp_node) > 720 { > 721 struct arm_ni_cd *cd; > 722 int node; > 723 > 724 cd = hlist_entry_safe(cpuhp_node, struct arm_ni_cd, cpuhp_node); > 725 node = dev_to_node(cd_to_ni(cd)->dev); > > There isn't any point in using the _safe() version of hlist_entry() unless we're > going to check for NULL. Hmm, this was just following the same pattern as every other PMU driver, which dates all the way back to the original multi-instance implementation[1]. Seems like one for a tree-wide cleanup if anyone's sufficiently bothered. Thanks, Robin. [1] https://lore.kernel.org/all/1471024183-12666-1-git-send-email-bigeasy@linutronix.de/ > > --> 726 if (cpu_to_node(cd->cpu) != node && cpu_to_node(cpu) == node) > 727 arm_ni_pmu_migrate(cd, cpu); > 728 return 0; > 729 } > > regards, > dan carpenter