From patchwork Mon Aug 12 13:53:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suzuki K Poulose X-Patchwork-Id: 171076 Delivered-To: patch@linaro.org Received: by 2002:a92:d204:0:0:0:0:0 with SMTP id y4csp2866722ily; Mon, 12 Aug 2019 06:53:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqzwK/9UMsNtqoFIJQoBM0YqgPOBJbtS+KwBqURUpzDKlIVqgqUb2XOcw81g7eR9zrGKLoU6 X-Received: by 2002:aa7:9a52:: with SMTP id x18mr7076074pfj.8.1565618014511; Mon, 12 Aug 2019 06:53:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565618014; cv=none; d=google.com; s=arc-20160816; b=mo+ZPJjXEiwd8XFl3EyKzD2u/4bHP5MBIBSQ7vo5inhvcG5KFSQBs/SVxCwq0u8+q6 NgFVqdTYofRarHHrJzetuoXrUdTb87SZVqk8XQyRQjP77o4p3e7D3XgOWx/pGKvR4I6I bWW52ydAWfk+sRlUc37bntntdH17w3DmJkeAVXz6y11SOWZz55+u6iUP2TN43TKzNckj r20HWDZ01u0d9twKeidq6OIPcSz68UZBip7s7ybBkoN95ucJgt8W7HVvPcWrUFRcg8R+ B5aOTM5rtA6QiVl3EdACHmsdxxzOs/DPzFLF1OKdV216hi5G2KtKTqX59tv4lvX6vibf Lxdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=BG719VUN9AmSJig+mg37KTM03+8hJtETVltgswoCNWg=; b=HQAIr+nokncJDDW3Js1R9fYmXex1osS6IkUU2d+hnYeEh3SflyenkW4d+aFjtkPTzF sY8QCTzXbnnE2YHuViGkTOyBLzwF7wyAWelQcnZbLuQNkw1TY7VEcOSYBaD/BvCmMWPP DhPnQb0JyfeMSyxH8ZTpPIwLnZtIO/FRpQWACBgDNlb95+qJQzDA7G+xWGffQPrpdvhY VCvg+jO2RhUg2jbHY9BdGxXN9ZNYfDwk9lpI7PxW1L+ZdSNZGBiz8dPmp+3cNC0BW924 00xRFz9NIDtbUBa3gMizpEVahUCs9qykAKgkGYdCG4HdY/+ikgvK3KLWMEym+fwf/UYn TqQQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c67si9282954pfb.211.2019.08.12.06.53.34; Mon, 12 Aug 2019 06:53:34 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727084AbfHLNxd (ORCPT + 14 others); Mon, 12 Aug 2019 09:53:33 -0400 Received: from foss.arm.com ([217.140.110.172]:50496 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726558AbfHLNxd (ORCPT ); Mon, 12 Aug 2019 09:53:33 -0400 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 F320915A2; Mon, 12 Aug 2019 06:53:32 -0700 (PDT) Received: from dawn-kernel.cambridge.arm.com (unknown [10.1.197.116]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 3226B3F718; Mon, 12 Aug 2019 06:53:32 -0700 (PDT) From: Suzuki K Poulose To: stable@vger.kernel.org Cc: suzuki.poulose@arm.com, mathieu.poirier@linaro.org, linux-arm-kernel@lists.infradead.org, gregkh@linuxfoundation.org Subject: [PATCH] coresight: Fix DEBUG_LOCKS_WARN_ON for uninitialized attribute Date: Mon, 12 Aug 2019 14:53:28 +0100 Message-Id: <20190812135328.30952-1-suzuki.poulose@arm.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org commit 5511c0c309db4c526a6e9f8b2b8a1483771574bc upstream While running the linux-next with CONFIG_DEBUG_LOCKS_ALLOC enabled, I get the following splat. BUG: key ffffcb5636929298 has not been registered! ------------[ cut here ]------------ DEBUG_LOCKS_WARN_ON(1) WARNING: CPU: 1 PID: 53 at kernel/locking/lockdep.c:3669 lockdep_init_map+0x164/0x1f0 CPU: 1 PID: 53 Comm: kworker/1:1 Tainted: G W 5.2.0-next-20190712-00015-g00ad4634222e-dirty #603 Workqueue: events amba_deferred_retry_func pstate: 60c00005 (nZCv daif +PAN +UAO) pc : lockdep_init_map+0x164/0x1f0 lr : lockdep_init_map+0x164/0x1f0 [ trimmed ] Call trace: lockdep_init_map+0x164/0x1f0 __kernfs_create_file+0x9c/0x158 sysfs_add_file_mode_ns+0xa8/0x1d0 sysfs_add_file_to_group+0x88/0xd8 etm_perf_add_symlink_sink+0xcc/0x138 coresight_register+0x110/0x280 tmc_probe+0x160/0x420 [ trimmed ] ---[ end trace ab4cc669615ba1b0 ]--- Fix this by initialising the dynamically allocated attribute properly. Fixes: bb8e370bdc14 ("coresight: perf: Add "sinks" group to PMU directory") Cc: stable@vger.kernel.org # 5.2.x- Cc: Mathieu Poirier Signed-off-by: Suzuki K Poulose --- drivers/hwtracing/coresight/coresight-etm-perf.c | 1 + 1 file changed, 1 insertion(+) -- 2.21.0 diff --git a/drivers/hwtracing/coresight/coresight-etm-perf.c b/drivers/hwtracing/coresight/coresight-etm-perf.c index 3c6294432748..1ef098ff27c3 100644 --- a/drivers/hwtracing/coresight/coresight-etm-perf.c +++ b/drivers/hwtracing/coresight/coresight-etm-perf.c @@ -544,6 +544,7 @@ int etm_perf_add_symlink_sink(struct coresight_device *csdev) /* See function coresight_get_sink_by_id() to know where this is used */ hash = hashlen_hash(hashlen_string(NULL, name)); + sysfs_attr_init(&ea->attr.attr); ea->attr.attr.name = devm_kstrdup(pdev, name, GFP_KERNEL); if (!ea->attr.attr.name) return -ENOMEM;