提交 b2a4cc3a 编写于 作者: G Guenter Roeck

hwmon: (core) Explain why at least two attribute groups are allocated

A list of sysfs attribute groups is NULL-terminated, so we always need
to allocate data for at least two groups (the dynamically generated group
plus the NULL pointer). Add a comment to explain the situation.
Signed-off-by: NGuenter Roeck <linux@roeck-us.net>
上级 239552f4
...@@ -561,7 +561,7 @@ __hwmon_device_register(struct device *dev, const char *name, void *drvdata, ...@@ -561,7 +561,7 @@ __hwmon_device_register(struct device *dev, const char *name, void *drvdata,
if (chip) { if (chip) {
struct attribute **attrs; struct attribute **attrs;
int ngroups = 2; int ngroups = 2; /* terminating NULL plus &hwdev->groups */
if (groups) if (groups)
for (i = 0; groups[i]; i++) for (i = 0; groups[i]; i++)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册