Discard devices with zero feature.

git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4637 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
Jean Delvare committed 2007-07-21 09:28:12 +00:00
1 parent f302998cd2
commit 98110858fe
2 files changed
+11 -3

No files matched your search

-2
View File
@@ -347,8 +347,6 @@ const sensors_feature_data *sensors_get_all_features(sensors_chip_name name,
if (sensors_match_chip(sensors_proc_chips[i].chip, name)) {
feature_list = sensors_proc_chips[i].feature;
if (!*nr1 && !*nr2) { /* Return the first entry */
if (!feature_list[0].data.name) /* The list may be empty */
return NULL;
*nr1 = *nr2 = 1;
return &feature_list->data;
}
+11 -1
View File
@@ -166,6 +166,11 @@ static int sensors_read_dynamic_chip(sensors_chip_features *chip,
fnum++;
}
if (fnum == 1) { /* No feature */
chip->feature = NULL;
return 0;
}
dyn_features = calloc(fnum, sizeof(sensors_chip_feature));
if (dyn_features == NULL) {
sensors_fatal_error(__FUNCTION__,"Out of memory");
@@ -203,6 +208,7 @@ int sensors_init_sysfs(void)
static int sensors_read_one_sysfs_chip(struct sysfs_device *dev)
{
int domain, bus, slot, fn;
int err = -SENSORS_ERR_PARSE;
struct sysfs_attribute *attr, *bus_attr;
char bus_path[SYSFS_PATH_MAX];
sensors_chip_features entry;
@@ -259,6 +265,10 @@ static int sensors_read_one_sysfs_chip(struct sysfs_device *dev)
if (sensors_read_dynamic_chip(&entry, dev) < 0)
goto exit_free;
if (!entry.feature) { /* No feature, discard chip */
err = 0;
goto exit_free;
}
sensors_add_proc_chips(&entry);
return 0;
@@ -266,7 +276,7 @@ static int sensors_read_one_sysfs_chip(struct sysfs_device *dev)
exit_free:
free(entry.chip.prefix);
free(entry.chip.busname);
return -SENSORS_ERR_PARSE;
return err;
}
/* returns 0 if successful, !0 otherwise */