Changeset 5795

Show
Ignore:
Timestamp:
11/04/09 20:11:41 (4 years ago)
Author:
andy
Message:

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.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lm-sensors/trunk/prog/sensord/sense.c

    r5794 r5795  
    4646static int idChip(const sensors_chip_name *chip) 
    4747{ 
    48         const char *adapter; 
    49  
    50         sensorLog(LOG_INFO, "Chip: %s", chipName(chip)); 
     48        const char *name, *adapter; 
     49 
     50        name = chipName(chip); 
     51        if (!name) { 
     52                sensorLog(LOG_ERR, "Error getting chip name"); 
     53                return -1; 
     54        } 
     55 
     56        sensorLog(LOG_INFO, "Chip: %s", name); 
     57 
    5158        adapter = sensors_get_adapter_name(&chip->bus); 
    52         if (adapter) 
     59        if (!adapter) 
     60                sensorLog(LOG_INFO, "Error getting adapter name"); 
     61        else 
    5362                sensorLog(LOG_INFO, "Adapter: %s", adapter); 
    5463 
     
    152161        int i, ret = 0; 
    153162 
    154         if (action == DO_READ) 
     163        if (action == DO_READ) { 
    155164                ret = idChip(chip); 
     165                if (ret) 
     166                        return ret; 
     167        } 
    156168 
    157169        for (i = 0; features[i].format; i++) {