linux/drivers/hwtracing/coresight
Suzuki K Poulose 80624263fa coresight: cti: Initialize dynamic sysfs attributes
With LOCKDEP enabled, CTI driver triggers the following splat due
to uninitialized lock class for dynamically allocated attribute
objects.

[    5.372901] coresight etm0: CPU0: ETM v4.0 initialized
[    5.376694] coresight etm1: CPU1: ETM v4.0 initialized
[    5.380785] coresight etm2: CPU2: ETM v4.0 initialized
[    5.385851] coresight etm3: CPU3: ETM v4.0 initialized
[    5.389808] BUG: key ffff00000564a798 has not been registered!
[    5.392456] ------------[ cut here ]------------
[    5.398195] DEBUG_LOCKS_WARN_ON(1)
[    5.398233] WARNING: CPU: 1 PID: 32 at kernel/locking/lockdep.c:4623 lockdep_init_map_waits+0x14c/0x260
[    5.406149] Modules linked in:
[    5.415411] CPU: 1 PID: 32 Comm: kworker/1:1 Not tainted 5.9.0-12034-gbbe85027ce80 #51
[    5.418553] Hardware name: Qualcomm Technologies, Inc. APQ 8016 SBC (DT)
[    5.426453] Workqueue: events amba_deferred_retry_func
[    5.433299] pstate: 40000005 (nZcv daif -PAN -UAO -TCO BTYPE=--)
[    5.438252] pc : lockdep_init_map_waits+0x14c/0x260
[    5.444410] lr : lockdep_init_map_waits+0x14c/0x260
[    5.449007] sp : ffff800012bbb720
...

[    5.531561] Call trace:
[    5.536847]  lockdep_init_map_waits+0x14c/0x260
[    5.539027]  __kernfs_create_file+0xa8/0x1c8
[    5.543539]  sysfs_add_file_mode_ns+0xd0/0x208
[    5.548054]  internal_create_group+0x118/0x3c8
[    5.552307]  internal_create_groups+0x58/0xb8
[    5.556733]  sysfs_create_groups+0x2c/0x38
[    5.561160]  device_add+0x2d8/0x768
[    5.565148]  device_register+0x28/0x38
[    5.568537]  coresight_register+0xf8/0x320
[    5.572358]  cti_probe+0x1b0/0x3f0

...

Fix this by initializing the attributes when they are allocated.

Fixes: 3c5597e398 ("coresight: cti: Add connection information to sysfs")
Reported-by: Leo Yan <leo.yan@linaro.org>
Tested-by: Leo Yan <leo.yan@linaro.org>
Cc: Mike Leach <mike.leach@linaro.org>
Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
Link: https://lore.kernel.org/r/20201029164559.1268531-2-mathieu.poirier@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-10-29 20:10:25 +01:00
..
coresight-catu.c coresight: catu: Allow catu drivers to be built as modules 2020-09-28 19:47:42 +02:00
coresight-catu.h coresight: tmc-etr: Add function to register catu ops 2020-09-28 19:47:42 +02:00
coresight-core.c coresight: add module license 2020-10-29 08:36:41 +01:00
coresight-cpu-debug.c coresight: cpu_debug: Define MODULE_DEVICE_TABLE 2020-09-28 19:47:40 +02:00
coresight-cti-core.c coresight: cti: Allow cti to be built as a module 2020-09-28 19:47:42 +02:00
coresight-cti-platform.c Char/Misc driver patches for 5.8-rc1 2020-06-07 10:59:32 -07:00
coresight-cti-sysfs.c coresight: cti: Initialize dynamic sysfs attributes 2020-10-29 20:10:25 +01:00
coresight-cti.h coresight: Include required headers in C files 2020-05-19 16:31:18 +02:00
coresight-etb10.c coresight: etb: Allow etb to be built as a module 2020-09-28 19:47:41 +02:00
coresight-etm3x-core.c coresight: etm3x: Allow etm3x to be built as a module 2020-09-28 19:47:41 +02:00
coresight-etm3x-sysfs.c coresight: etm: Clean up device specific data 2019-06-19 20:29:14 +02:00
coresight-etm4x-core.c coresight: etm4x: Fix save and restore of TRCVMIDCCTLR1 register 2020-09-28 19:47:42 +02:00
coresight-etm4x-sysfs.c coresight: etm4x: Fix mis-usage of nr_resource in sysfs interface 2020-09-17 18:46:05 +02:00
coresight-etm4x.h coresight: etm4x: Fix number of resources check for ETM 4.3 and above 2020-09-17 18:46:05 +02:00
coresight-etm-cp14.c coresight: Moving framework and drivers to SPDX identifier 2018-05-14 16:19:59 +02:00
coresight-etm-perf.c coresight: Fix uninitialised pointer bug in etm_setup_aux() 2020-10-29 20:10:25 +01:00
coresight-etm-perf.h coresight: core: Allow the coresight core driver to be built as a module 2020-09-28 19:47:42 +02:00
coresight-etm.h coresight: etm: Clean up device specific data 2019-06-19 20:29:14 +02:00
coresight-funnel.c coresight: funnel: Allow funnel driver to be built as module 2020-09-28 19:47:41 +02:00
coresight-platform.c coresight: cti: Allow cti to be built as a module 2020-09-28 19:47:42 +02:00
coresight-priv.h coresight: cti: Add function to register cti associate ops 2020-09-28 19:47:41 +02:00
coresight-replicator.c coresight: replicator: Allow replicator driver to be built as module 2020-09-28 19:47:41 +02:00
coresight-stm.c coresight: stm: Allow to build coresight-stm as a module 2020-09-28 19:47:40 +02:00
coresight-sysfs.c coresight: Export global symbols 2020-09-28 19:47:40 +02:00
coresight-tmc-core.c coresight: tmc: Allow tmc to be built as a module 2020-09-28 19:47:41 +02:00
coresight-tmc-etf.c coresight: Add coresight prefix to barrier_pkt 2020-09-28 19:47:40 +02:00
coresight-tmc-etr.c coresight: tmc-etr: Add function to register catu ops 2020-09-28 19:47:42 +02:00
coresight-tmc.h coresight: tmc-etr: Add function to register catu ops 2020-09-28 19:47:42 +02:00
coresight-tpiu.c coresight: tpiu: Allow tpiu to be built as a module 2020-09-28 19:47:41 +02:00
Kconfig coresight: core: Allow the coresight core driver to be built as a module 2020-09-28 19:47:42 +02:00
Makefile coresight: core: Allow the coresight core driver to be built as a module 2020-09-28 19:47:42 +02:00