2
0
mirror of https://github.com/lm-sensors/lm-sensors synced 2025-08-31 06:15:15 +00:00

sensord: Evaluate return value of idChip()

Evaluate return value of idChip().

Some of the functions called from idChip() can fail which means
idChip() can return an error. Callers of idChip() should be aware of
this.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5795 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
Andre Prendel
2009-11-04 19:11:41 +00:00
parent 57e7762901
commit a079f9c35d

View File

@@ -45,11 +45,20 @@ static const char *chipName(const sensors_chip_name *chip)
static int idChip(const sensors_chip_name *chip)
{
const char *adapter;
const char *name, *adapter;
name = chipName(chip);
if (!name) {
sensorLog(LOG_ERR, "Error getting chip name");
return -1;
}
sensorLog(LOG_INFO, "Chip: %s", name);
sensorLog(LOG_INFO, "Chip: %s", chipName(chip));
adapter = sensors_get_adapter_name(&chip->bus);
if (adapter)
if (!adapter)
sensorLog(LOG_INFO, "Error getting adapter name");
else
sensorLog(LOG_INFO, "Adapter: %s", adapter);
return 0;
@@ -151,8 +160,11 @@ static int doKnownChip(const sensors_chip_name *chip,
const FeatureDescriptor *features = descriptor->features;
int i, ret = 0;
if (action == DO_READ)
if (action == DO_READ) {
ret = idChip(chip);
if (ret)
return ret;
}
for (i = 0; features[i].format; i++) {
ret = do_features(chip, features + i, action);