hwmon: Make name attribute mandatory for new APIs
Guenter Roeck
maintainerPATCH 1/1 hwmon: Make name attribute mandatory for new APIs
It does not make sense to use one of the the new APIs when not even providing a name attribute. Make it mandatory.
Signed-off-by Guenter Roeck <[email protected]>
--- drivers/hwmon/hwmon.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/hwmon/hwmon.c +6 -0
@@ -651,6 +651,9 @@ hwmon_device_register_with_groups(struct device *dev, const char *name, void *drvdata, const struct attribute_group **groups) { +if (!name) +return -EINVAL ; +return __hwmon_device_register (dev, name, drvdata,NULL , groups); }EXPORT_SYMBOL_GPL (hwmon_device_register_with_groups);
@@ -674,6 +677,9 @@ hwmon_device_register_with_info(struct device *dev, const char *name, const struct hwmon_chip_info *chip, const struct attribute_group **extra_groups) { + if (!name) + return -EINVAL; +if (chip && (!chip->ops || !chip->ops->is_visible || !chip->info))return ERR_PTR (-EINVAL );
Signature · 1 line
2.7.4