From patchwork Mon Jan 23 16:47:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suzuki K Poulose X-Patchwork-Id: 13112572 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 1AAFFC05027 for ; Mon, 23 Jan 2023 16:52:44 +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=kn2xbgCeZLGY5nzpt6wiAynjwo7Y3XTlaLfvbVxc7J0=; b=vN8iqgJNM53h1J AEs+088fCkkJgkqzmWRg9NtSmpPeZhhSI4ycO/EjMqFzhoBfKsJjOh3swBGBr0hbZ89JqJX/8iM/7 KFEGQ2oJHxdIIKMuiuZNBVkUQUFJg69OfVzZufnk+ELlSLbLFGj4nuTwS1yq9Jy70gy96MYtpCyl0 QBTwYpTOsmuSbAZ6RxVwOqkuv5xkvb13NBNXMFC0WP7+3XnVshdWh+hH39kWWxfUkG02Tqy3k+V6s 5RsAL5jONpIQReXq+iZX+iz5RQ3yuYGLwn40g/sJiB2B9cF5QBK39KCjQjqaZrKIwmU9ha0zganIt IIGFde9p5ILy+WPQjXsg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pK02r-000hNJ-Cs; Mon, 23 Jan 2023 16:51:45 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pJzyW-000fTS-SW for linux-arm-kernel@lists.infradead.org; Mon, 23 Jan 2023 16:47:18 +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 4708EC14; Mon, 23 Jan 2023 08:47:55 -0800 (PST) Received: from ewhatever.cambridge.arm.com (ewhatever.cambridge.arm.com [10.1.197.1]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 73B1B3F71E; Mon, 23 Jan 2023 08:47:12 -0800 (PST) From: Suzuki K Poulose To: coresight@lists.linaro.org Cc: mike.leach@linaro.org, james.clark@arm.com, leo.yan@linaro.org, linux-arm-kernel@lists.infradead.org, lkp@intel.com, Suzuki K Poulose , Mao Jinlong Subject: [PATCH] coresight: Fix uninitialised variable use in coresight_disable Date: Mon, 23 Jan 2023 16:47:00 +0000 Message-Id: <20230123164700.1074064-1-suzuki.poulose@arm.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230123_084717_032956_2E9434E0 X-CRM114-Status: UNSURE ( 9.83 ) 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 Kernel test robot reports: drivers/hwtracing/coresight/coresight-core.c:1176:7: warning: variable 'hash' is used uninitialized whenever switch case is taken [-Wsometimes-uninitialized] case CORESIGHT_DEV_SUBTYPE_SOURCE_PROC: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/hwtracing/coresight/coresight-core.c:1195:24: note: uninitialized use occurs here idr_remove(&path_idr, hash); ^~~~ Fix this by moving the usage of the hash variable to where it actually should have been. Cc: Mao Jinlong Reported-by: kernel test robot Signed-off-by: Suzuki K Poulose Reviewed-by: James Clark --- drivers/hwtracing/coresight/coresight-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/hwtracing/coresight/coresight-core.c b/drivers/hwtracing/coresight/coresight-core.c index a798008ac56e..d3bf82c0de1d 100644 --- a/drivers/hwtracing/coresight/coresight-core.c +++ b/drivers/hwtracing/coresight/coresight-core.c @@ -1189,13 +1189,13 @@ void coresight_disable(struct coresight_device *csdev) pr_err("Path is not found for %s\n", dev_name(&csdev->dev)); goto out; } + idr_remove(&path_idr, hash); break; default: /* We can't be here */ break; } - idr_remove(&path_idr, hash); coresight_disable_path(path); coresight_release_path(path);