Changeset 6062

Show
Ignore:
Timestamp:
07/19/12 18:25:41 (10 months ago)
Author:
khali
Message:

Don't choke when no SPD EEPROM is found while the eeprom or at24 driver is
loaded. This can happen, handle the case gracefully.

Location:
i2c-tools/trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • i2c-tools/trunk/CHANGES

    r6059 r6062  
    66  decode-dimms: Decode module configuration type of DDR2 SDRAM 
    77                Decode bus width extension of DDR3 SDRAM 
     8                Don't choke when no EEPROM is found 
    89  i2c-dev.h: Minimize differences with kernel flavor 
    910             Move SMBus helper functions to include/i2c/smbus.h 
  • i2c-tools/trunk/eeprom/decode-dimms

    r6061 r6062  
    17261726sub get_dimm_list 
    17271727{ 
    1728         my (@dirs, $dir, $file, @files); 
     1728        my (@dirs, $dir, $opened, $file, @files); 
    17291729 
    17301730        if ($use_sysfs) { 
     
    17361736        foreach $dir (@dirs) { 
    17371737                next unless opendir(local *DIR, $dir); 
     1738                $opened++; 
    17381739                while (defined($file = readdir(DIR))) { 
    17391740                        if ($use_sysfs) { 
     
    17561757        } 
    17571758 
    1758         if (@files) { 
    1759                 return sort { $a->{file} cmp $b->{file} } @files; 
    1760         } elsif (! -d '/sys/module/eeprom') { 
    1761                 print "No EEPROM found, are you sure the eeprom module is loaded?\n"; 
     1759        if (!$opened) { 
     1760                print STDERR "No EEPROM found, try loading the eeprom or at24 module\n"; 
    17621761                exit; 
    17631762        } 
     1763 
     1764        return sort { $a->{file} cmp $b->{file} } @files; 
    17641765} 
    17651766