[PATCH linux dev-4.13 3/3] hwmon: occ: Properly initialize sysfs attributes

Benjamin Herrenschmidt benh at kernel.crashing.org
Tue May 29 14:28:33 AEST 2018


Otherwise, lockdep will complain

Signed-off-by: Benjamin Herrenschmidt <benh at kernel.crashing.org>
---
 drivers/hwmon/occ/common.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/hwmon/occ/common.c b/drivers/hwmon/occ/common.c
index 0673af00a99b..b99b2f66e3c2 100644
--- a/drivers/hwmon/occ/common.c
+++ b/drivers/hwmon/occ/common.c
@@ -1166,8 +1166,10 @@ static int occ_setup_sensor_attrs(struct occ *occ)
 	}
 
 	/* put the sensors in the group */
-	for (i = 0; i < num_attrs; ++i)
+	for (i = 0; i < num_attrs; ++i) {
+		sysfs_attr_init(&occ->attrs[i].sensor.dev_attr.attr);
 		occ->group.attrs[i] = &occ->attrs[i].sensor.dev_attr.attr;
+	}
 
 	return 0;
 }
-- 
2.17.0



More information about the openbmc mailing list