Skip to contentSkip to conversation

hwmon: (nct6683) Add missing sysfs attibute initialization

PATCH In review Guenter Roeck 2 participants 5 messages May 28, 2015 – May 29, 2015 Hardware monitoring

lore
Share & tools
lore

Guenter Roeck

author maintainer
#0 lore raw

PATCH 2/2 hwmon: (nct6683) Add missing sysfs attibute initialization

The following error message is seen when loading the nct6683 driver with DEBUG_LOCK_ALLOC enabled.

BUG: key ffff88040b2f0030 not in .data!
------------[ cut here ]------------
WARNING: CPU: 0 PID: 186 at kernel/locking/lockdep.c:2988
				lockdep_init_map+0x469/0x630()

DEBUG_LOCKS_WARN_ON(1)

Caused by a missing call to sysfs_attr_init() when initializing sysfs attributes.

---
 drivers/hwmon/nct6683.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/hwmon/nct6683.c +2 -0
index f3830db02d46..37f01702d081 100644
@@ -439,6 +439,7 @@ nct6683_create_attr_group(struct device *dev, struct sensor_template_group *tg,
 				 (*t)->dev_attr.attr.name, tg->base + i);
 			if ((*t)->s2) {
 				a2 = &su->u.a2;
+				sysfs_attr_init(&a2->dev_attr.attr);
 				a2->dev_attr.attr.name = su->name;
 				a2->nr = (*t)->u.s.nr + i;
 				a2->index = (*t)->u.s.index;
@@ -449,6 +450,7 @@ nct6683_create_attr_group(struct device *dev, struct sensor_template_group *tg,
 				*attrs = &a2->dev_attr.attr;
 			} else {
 				a = &su->u.a1;
+				sysfs_attr_init(&a->dev_attr.attr);
 				a->dev_attr.attr.name = su->name;
 				a->index = (*t)->u.index + i;
 				a->dev_attr.attr.mode -- 

2.1.0

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

Reviewed-by on v1 2/2
#1 lore raw
Quoted 31 lines · Guenter Roeck

The following error message is seen when loading the nct6683 driver with DEBUG_LOCK_ALLOC enabled.

BUG: key ffff88040b2f0030 not in .data!
------------[ cut here ]------------
WARNING: CPU: 0 PID: 186 at kernel/locking/lockdep.c:2988
				lockdep_init_map+0x469/0x630()

DEBUG_LOCKS_WARN_ON(1)

Caused by a missing call to sysfs_attr_init() when initializing sysfs attributes.

---
 drivers/hwmon/nct6683.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/hwmon/nct6683.c +1 -0
index f3830db02d46..37f01702d081 100644
@@ -439,6 +439,7 @@ nct6683_create_attr_group(struct device *dev, struct sensor_template_group *tg,
 				 (*t)->dev_attr.attr.name, tg->base + i);
 			if ((*t)->s2) {
 				a2 = &su->u.a2;
+				sysfs_attr_init(&a2->dev_attr.attr);
 				a2->dev_attr.attr.name = su->name;
 				a2->nr = (*t)->u.s.nr + i;
 				a2->index = (*t)->u.s.index;

drivers/hwmon/nct6683.c nct6683_create_attr_group(struct device *dev, struct sensor_template_group *tg, · line 456

Quoted 7 lines
drivers/hwmon/nct6683.c +1 -0
@@ -449,6 +450,7 @@ nct6683_create_attr_group(struct device *dev, struct sensor_template_group *tg,
 				*attrs = &a2->dev_attr.attr;
 			} else {
 				a = &su->u.a1;
+				sysfs_attr_init(&a->dev_attr.attr);
 				a->dev_attr.attr.name = su->name;
 				a->index = (*t)->u.index + i;
 				a->dev_attr.attr.mode 

Looks like the abituguru and abituguru3 drivers suffer from the same bug?

Signature · 7 lines
Jean Delvare
SUSE L3 Support

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
author maintainer
#2 lore raw
In reply to Guenter Roeck

Hi Jean,

Quoted 32 lines · Jean Delvare
Quoted 31 lines · Guenter Roeck

The following error message is seen when loading the nct6683 driver with DEBUG_LOCK_ALLOC enabled.

BUG: key ffff88040b2f0030 not in .data!
------------[ cut here ]------------
WARNING: CPU: 0 PID: 186 at kernel/locking/lockdep.c:2988
				lockdep_init_map+0x469/0x630()

DEBUG_LOCKS_WARN_ON(1)

Caused by a missing call to sysfs_attr_init() when initializing sysfs attributes.

---
  drivers/hwmon/nct6683.c | 2 ++
  1 file changed, 2 insertions(+)
drivers/hwmon/nct6683.c +1 -0
index f3830db02d46..37f01702d081 100644
@@ -439,6 +439,7 @@ nct6683_create_attr_group(struct device *dev, struct sensor_template_group *tg,
  				 (*t)->dev_attr.attr.name, tg->base + i);
  			if ((*t)->s2) {
  				a2 = &su->u.a2;
+				sysfs_attr_init(&a2->dev_attr.attr);
  				a2->dev_attr.attr.name = su->name;
  				a2->nr = (*t)->u.s.nr + i;
  				a2->index = (*t)->u.s.index;
@@ -449,6 +450,7 @@ nct6683_create_attr_group(struct device *dev, struct sensor_template_group *tg,
Quoted 9 lines

drivers/hwmon/nct6683.c nct6683_create_attr_group(struct device *dev, struct sensor_template_group *tg,

Quoted 7 lines
drivers/hwmon/nct6683.c +1 -0
  				*attrs = &a2->dev_attr.attr;
  			} else {
  				a = &su->u.a1;
+				sysfs_attr_init(&a->dev_attr.attr);
  				a->dev_attr.attr.name = su->name;
  				a->index = (*t)->u.index + i;
  				a->dev_attr.attr.mode >

Thanks a lot for both reviews.

Quoted 3 lines

Looks like the abituguru and abituguru3 drivers suffer from the same bug?

I'll have a look and submit more patches if needed.

Thanks,
Guenter

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

author maintainer
#3 lore raw
In reply to Guenter Roeck

Hi Jean,

Quoted 5 lines · Jean Delvare

Looks like the abituguru and abituguru3 drivers suffer from the same bug?

Those drivers derive the attr values from a template which is pre-initialized with SENSOR_ATTR_2. With this, the initialization should be taken care of. Am I missing something ?

Thanks,
Guenter

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

#4 lore raw
In reply to Guenter Roeck
Quoted 6 lines · Guenter Roeck

Hi Jean,

Quoted 2 lines · Jean Delvare
Quoted 7 lines
Quoted 3 lines

Looks like the abituguru and abituguru3 drivers suffer from the same bug?

Those drivers derive the attr values from a template which is pre-initialized with SENSOR_ATTR_2. With this, the initialization should be taken care of. Am I missing something ?

Probably not. My naive assumption was based on the lack of sysfs_attr_init() call in these drivers. If the initialization is done differently then alright. Thanks for verifying.

Signature · 7 lines
Jean Delvare
SUSE L3 Support

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors