Skip to content

Commit 5511c0c

Browse files
Suzuki K Poulosegregkh
Suzuki K Poulose
authored andcommitted
coresight: Fix DEBUG_LOCKS_WARN_ON for uninitialized attribute
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 torvalds#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. Cc: Mathieu Poirier <[email protected]> Fixes: bb8e370 ("coresight: perf: Add "sinks" group to PMU directory") Cc: stable <[email protected]> Signed-off-by: Suzuki K Poulose <[email protected]> [Fixed a typograhic error in the changelog] Signed-off-by: Mathieu Poirier <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 1dd38ae commit 5511c0c

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/hwtracing/coresight/coresight-etm-perf.c

+1
Original file line numberDiff line numberDiff line change
@@ -544,6 +544,7 @@ int etm_perf_add_symlink_sink(struct coresight_device *csdev)
544544
/* See function coresight_get_sink_by_id() to know where this is used */
545545
hash = hashlen_hash(hashlen_string(NULL, name));
546546

547+
sysfs_attr_init(&ea->attr.attr);
547548
ea->attr.attr.name = devm_kstrdup(dev, name, GFP_KERNEL);
548549
if (!ea->attr.attr.name)
549550
return -ENOMEM;

0 commit comments

Comments
 (0)