提交 8aec013a 编写于 作者: M Mark Bloch 提交者: Doug Ledford

IB/core: Initialize sysfs attributes before sysfs create group

For dynamically allocated sysfs attributes there is a need to call
sysfs_attr_init in order to comply with lockdep, not calling it
will result in error complaining key is not in .data section.

Fixes: b40f4757 ("IB/core: Make device counter infrastructure dynamic")
Signed-off-by: NMark Bloch <markb@mellanox.com>
Signed-off-by: NLeon Romanovsky <leon@kernel.org>
Signed-off-by: NDoug Ledford <dledford@redhat.com>
上级 9b29953b
...@@ -925,10 +925,13 @@ static void setup_hw_stats(struct ib_device *device, struct ib_port *port, ...@@ -925,10 +925,13 @@ static void setup_hw_stats(struct ib_device *device, struct ib_port *port,
hsag->attrs[i] = alloc_hsa(i, port_num, stats->names[i]); hsag->attrs[i] = alloc_hsa(i, port_num, stats->names[i]);
if (!hsag->attrs[i]) if (!hsag->attrs[i])
goto err; goto err;
sysfs_attr_init(hsag->attrs[i]);
} }
/* treat an error here as non-fatal */ /* treat an error here as non-fatal */
hsag->attrs[i] = alloc_hsa_lifespan("lifespan", port_num); hsag->attrs[i] = alloc_hsa_lifespan("lifespan", port_num);
if (hsag->attrs[i])
sysfs_attr_init(hsag->attrs[i]);
if (port) { if (port) {
struct kobject *kobj = &port->kobj; struct kobject *kobj = &port->kobj;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册