diff options
author | Guenter Roeck <linux@roeck-us.net> | 2016-10-16 17:11:52 -0700 |
---|---|---|
committer | Guenter Roeck <linux@roeck-us.net> | 2016-12-09 21:54:21 -0800 |
commit | b2a4cc3a060da0de17ab1e854cef89f5e74e2064 (patch) | |
tree | b6bcf8602259387d82bd09a793c725f5cbb00e18 /drivers/hwmon/hwmon.c | |
parent | 239552f495b91fc8f3fba4b5094233e053d265cb (diff) |
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: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon/hwmon.c')
-rw-r--r-- | drivers/hwmon/hwmon.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/hwmon/hwmon.c b/drivers/hwmon/hwmon.c index a0b5becf91fa..8dc0466a9307 100644 --- a/drivers/hwmon/hwmon.c +++ b/drivers/hwmon/hwmon.c @@ -561,7 +561,7 @@ __hwmon_device_register(struct device *dev, const char *name, void *drvdata, if (chip) { struct attribute **attrs; - int ngroups = 2; + int ngroups = 2; /* terminating NULL plus &hwdev->groups */ if (groups) for (i = 0; groups[i]; i++) |