From patchwork Thu Mar 2 20:57:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Besar Wicaksono X-Patchwork-Id: 13157901 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 55C6AC6FA8E for ; Thu, 2 Mar 2023 20:58:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:CC :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=dDxdnFWpWoOAR7oFryvzg6Eu3sJvJjBWh3vj1bOowWk=; b=InPy3eXRekDU1H oVP5xyKvWWcYoJGHMaq2qLZrL6p0F3I928EsfoY70G8fmIt05rixPr1/boYPBwrpc1fQCuR/x3iQS Xc7wTzhF2jhcUcx36QmVijx0PSWXUNrBFv3nimvKP2FOlYhxREaa7EHe+e2hN93Pkh/gNMlLIWL3I ZdRxAOHq+3KLvcCPTrE3zJO0Y/YABAc0bsAUaBtKyp/FCv6hwC9u1KWVTMDD/1EFa4eDXFon63wPS VtVcv4jI2nlPxxvMke7B/fBsuRCGv9nHF6Y3vZFzNqG4ihsk7cjUM+93HmL1fSytFn8XUPTdcEQkQ ffC+v9cPXJ/lS0xap9+A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pXpzc-003J87-8P; Thu, 02 Mar 2023 20:57:36 +0000 Received: from mail-bn8nam12on20622.outbound.protection.outlook.com ([2a01:111:f400:fe5b::622] helo=NAM12-BN8-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pXpzY-003J66-LQ for linux-arm-kernel@lists.infradead.org; Thu, 02 Mar 2023 20:57:34 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=g7XzithwABBKpjUP+ImeT8dDzz5mUCD+3HB7Rsbgw3M73JRvWSbSGDhE7OosqtvX8GHoWr8424NpiihPqaBx+k3xPsI38DgM7AUdb35ONea9z/tqhqKxKue6BwDaLrQTiEZ7uPrBDKO/AJqK48xE3nPBC4gmYFc8u/xUQfwI31lbgQd8kBJLmuA8B/5bWn0SJ6o1oFgQjpDmjIOiiOjcBL1cLXEEa9LN/YhaAJ5Lboe+v+kurJew0pr2URzTk2IqWvyc2rrcPnLQ0WD3RwhHr6wHWA9hWATSwII600HiPR/iXwhIV0n4vlFzbnWZ+voy8dY3ztjcOfdXXamIZkjc/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=+E0s18b1bkSSDtNJBWZmzyAZKiBmzRwIq9U2pAte5uQ=; b=W+kBEzysLeKtN/TgznJHyNkfpVhkxWIPegwvZ+eITIjxCGK8Et8e2XKJATAsUf3Ni3zHE745QTlPyd7T/q+DpF4+9eVR/WFGo3OFj+qGRB4UpGJ9y/qQ7XllW6jHQsy6jhIapTm1pPCuiW9D5GI9bDSJg2KkqBAUXsB9kSGLI2+Asy/Fv5vNphK+1nzlfmd5Gnr7uHq+xIIweUGXQ1is0OBh5FAZPy0+TPovuVnS7j1m7CnNlcoJip1iv7uVIFXHMJRSQdFYtfoh2ud4azVaSGSlCIoolK91Vm4rl7OM/ASTgVtMJt6vr3egG/+CIz+p/0wF4PrgUKIlR/HyD7rCxg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.233) smtp.rcpttodomain=infradead.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=+E0s18b1bkSSDtNJBWZmzyAZKiBmzRwIq9U2pAte5uQ=; b=HmAazkm2wiO5FnkNPiY/J4ihH6q9GogkOYdiciheMnysSnrCCLxtdpcRLnDDVYJgq+gghGVz3wqgEj8sztSCIoq0b4DHDNzwUI4J7qGbpKbhDkuzMP+1lzhD2c0gfy9vSO7nT5lW8M2WyTrSb2rcCsRI+mB6YST44NniXkDMxEAJIz6yImOzdhwYCLw4VnXVmF9SeofAUvuK5hkMIAry+oWfrTYfsLvhU6q7+s8R7Cp2PDD2lvx0dzyJmHcj/k6DrgQBkO/j2f6xxWnV4jSrWDxn7JzC8rAOA+OvvB9caF5twoXsMtYoyvdhbuo8rlFD6TuyOeLtyWNxKrUV2nVuhA== Received: from DM6PR07CA0080.namprd07.prod.outlook.com (2603:10b6:5:337::13) by MN2PR12MB4375.namprd12.prod.outlook.com (2603:10b6:208:24f::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6156.19; Thu, 2 Mar 2023 20:57:26 +0000 Received: from DS1PEPF0000E64A.namprd02.prod.outlook.com (2603:10b6:5:337:cafe::fe) by DM6PR07CA0080.outlook.office365.com (2603:10b6:5:337::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6156.19 via Frontend Transport; Thu, 2 Mar 2023 20:57:26 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.233) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.118.233 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.233; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.118.233) by DS1PEPF0000E64A.mail.protection.outlook.com (10.167.18.40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6156.12 via Frontend Transport; Thu, 2 Mar 2023 20:57:26 +0000 Received: from drhqmail202.nvidia.com (10.126.190.181) by mail.nvidia.com (10.127.129.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.5; Thu, 2 Mar 2023 12:57:25 -0800 Received: from drhqmail203.nvidia.com (10.126.190.182) by drhqmail202.nvidia.com (10.126.190.181) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.37; Thu, 2 Mar 2023 12:57:25 -0800 Received: from msst-build.nvidia.com (10.127.8.14) by mail.nvidia.com (10.126.190.182) with Microsoft SMTP Server id 15.2.986.5 via Frontend Transport; Thu, 2 Mar 2023 12:57:24 -0800 From: Besar Wicaksono To: , , , , CC: , , , , , , Besar Wicaksono Subject: [PATCH v2] perf: arm_cspmu: Fix variable dereference warning Date: Thu, 2 Mar 2023 14:57:01 -0600 Message-ID: <20230302205701.35323-1-bwicaksono@nvidia.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS1PEPF0000E64A:EE_|MN2PR12MB4375:EE_ X-MS-Office365-Filtering-Correlation-Id: 5d17d723-a623-4949-b939-08db1b60baa4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: eB15WaeRydlYFiQ29luRwUMdpmUfsCRRO7yPDLsJG0KOHwWnLAEVjNkwWgHVHrYUkzcxbWTQwcQ5sfggMmyePMp3NCMnPYsvIpntBVF2qP6K1Jdf0Cj5pF94MohI0MbwhsUZt9lksRndBBe6pAFvR1kheRL2O3sJKtxyAopMJKrgPRySmYUW6mBrKeWdAY0sP8Dv3bFKWpkclBfUpIvhkbpZrTQKW2K1cuBj91cfmaxPopZOQAUdVfS7nSGo3LTnXxFRg2mqOx2eS7IapMx11NwDLgkY25DSBwJ3d8Q8JFeeNbfagrp8zWsw0z7sdEsXzQCS930NOpZ7Nlnb8lcv8ICv4v8m2iuOF0BIXiS7glxvUc4GIgjK0cH6De6RORUtxMgnx6ZdJNIAMhK4Zok/cyUMYKR/vVkbx+DW01tJZW+OFP3UB7vsKM5dqfrJXMz3p/X8Z5rKALPvVGtViumZ340Bgak7ebZmRtdKyB72Oh8ajPrgzaS4Brl3ypy/vGUOS0WZTE89crJ6tKcMZSV3C2Oq+4mUzXLT0IYnkP86kQofk6R2E64aFLKSrlENftqhKNGU1sRJVW9LfVQ8tA5Pvhsf3/M4L1DTlmWSI7YBLXdC4/klsQrsKvm4NyC3aCYVUvA7GO7ZvY95OHm3SMRhPZT+N/6SlpZyPRwbed11qOHvH3SLkK1KxOpZObgy/h0x5A6EQCiEFFsHVhQ//uK+KTfqjFSqOEl+HUoEe2pvvjMEtLgpVTqu/dfTQhPwT6+dibydjuJN6qLKaRznMcFs9mgUdRw86xGD0O7s2Z34lIo= X-Forefront-Antispam-Report: CIP:216.228.118.233;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc7edge2.nvidia.com;CAT:NONE;SFS:(13230025)(4636009)(376002)(396003)(136003)(39860400002)(346002)(451199018)(46966006)(40470700004)(36840700001)(2616005)(36756003)(82310400005)(8936002)(41300700001)(54906003)(40480700001)(40460700003)(8676002)(70586007)(70206006)(336012)(4326008)(186003)(86362001)(2906002)(36860700001)(426003)(83380400001)(47076005)(356005)(26005)(5660300002)(1076003)(107886003)(6666004)(316002)(7696005)(478600001)(966005)(110136005)(7636003)(82740400003);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Mar 2023 20:57:26.3818 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5d17d723-a623-4949-b939-08db1b60baa4 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.118.233];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: DS1PEPF0000E64A.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4375 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230302_125732_925478_2422916B X-CRM114-Status: UNSURE ( 9.95 ) X-CRM114-Notice: Please train this message. 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 Fix warning message from smatch tool: | smatch warnings: | drivers/perf/arm_cspmu/arm_cspmu.c:1075 arm_cspmu_find_cpu_container() | warn: variable dereferenced before check 'cpu_dev' (see line 1073) Reported-by: kernel test robot Reported-by: Dan Carpenter Link: https://lore.kernel.org/r/202302191227.kc0V8fM7-lkp@intel.com/ Reviewed-by: Suzuki K Poulose Signed-off-by: Besar Wicaksono Acked-by: Randy Dunlap --- Changes from v1: * Update commit subject and description * Added Reviewed-by from Suzuki v1: https://lore.kernel.org/linux-arm-kernel/20230301225657.30211-1-bwicaksono@nvidia.com/T/#u --- drivers/perf/arm_cspmu/arm_cspmu.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) base-commit: 7f7a8831520f12a3cf894b0627641fad33971221 diff --git a/drivers/perf/arm_cspmu/arm_cspmu.c b/drivers/perf/arm_cspmu/arm_cspmu.c index e31302ab7e37..a3f1c410b417 100644 --- a/drivers/perf/arm_cspmu/arm_cspmu.c +++ b/drivers/perf/arm_cspmu/arm_cspmu.c @@ -1078,12 +1078,14 @@ static int arm_cspmu_request_irq(struct arm_cspmu *cspmu) static inline int arm_cspmu_find_cpu_container(int cpu, u32 container_uid) { u32 acpi_uid; - struct device *cpu_dev = get_cpu_device(cpu); - struct acpi_device *acpi_dev = ACPI_COMPANION(cpu_dev); + struct device *cpu_dev; + struct acpi_device *acpi_dev; + cpu_dev = get_cpu_device(cpu); if (!cpu_dev) return -ENODEV; + acpi_dev = ACPI_COMPANION(cpu_dev); while (acpi_dev) { if (!strcmp(acpi_device_hid(acpi_dev), ACPI_PROCESSOR_CONTAINER_HID) &&