diff options
author | khali <khali@7894878c-1315-0410-8ee3-d5d059ff63e0> | 2012-07-19 16:47:54 +0000 |
---|---|---|
committer | khali <khali@7894878c-1315-0410-8ee3-d5d059ff63e0> | 2012-07-19 16:47:54 +0000 |
commit | 14144b804909dab2d397ecb9f66944a5f0a6471c (patch) | |
tree | 4c42d860999061f993354351a498cfa239680b36 | |
parent | 56b6b26e800c6aab80f8fe5fae3fa30a6d6d2c07 (diff) | |
download | i2c-tools-14144b804909dab2d397ecb9f66944a5f0a6471c.tar.gz |
Don't choke when no SPD EEPROM is found while the eeprom or at24 driver
is loaded. This can happen, handle the case gracefully.
git-svn-id: http://lm-sensors.org/svn/i2c-tools/branches/i2c-tools-3.1@6063 7894878c-1315-0410-8ee3-d5d059ff63e0
-rw-r--r-- | CHANGES | 1 | ||||
-rwxr-xr-x | eeprom/decode-dimms | 11 |
2 files changed, 7 insertions, 5 deletions
@@ -4,6 +4,7 @@ i2c-tools CHANGES SVN HEAD decode-dimms: Decode module configuration type of DDR2 SDRAM Decode bus width extension of DDR3 SDRAM + Don't choke when no EEPROM is found i2c-dev.h: Minimize differences with kernel flavor Move SMBus helper functions to include/i2c/smbus.h i2c-stub-from-dump: Be more tolerant on input dump format diff --git a/eeprom/decode-dimms b/eeprom/decode-dimms index ff66d45..7e2c8ec 100755 --- a/eeprom/decode-dimms +++ b/eeprom/decode-dimms @@ -1739,7 +1739,7 @@ sub sysfs_device_attribute sub get_dimm_list { - my (@dirs, $dir, $file, @files); + my (@dirs, $dir, $opened, $file, @files); if ($use_sysfs) { @dirs = ('/sys/bus/i2c/drivers/eeprom', '/sys/bus/i2c/drivers/at24'); @@ -1749,6 +1749,7 @@ sub get_dimm_list foreach $dir (@dirs) { next unless opendir(local *DIR, $dir); + $opened++; while (defined($file = readdir(DIR))) { if ($use_sysfs) { # We look for I2C devices like 0-0050 or 2-0051 @@ -1769,12 +1770,12 @@ sub get_dimm_list close(DIR); } - if (@files) { - return sort { $a->{file} cmp $b->{file} } @files; - } elsif (! -d '/sys/module/eeprom') { - print "No EEPROM found, are you sure the eeprom module is loaded?\n"; + if (!$opened) { + print STDERR "No EEPROM found, try loading the eeprom or at24 module\n"; exit; } + + return sort { $a->{file} cmp $b->{file} } @files; } # @dimm is a list of hashes. There's one hash for each EEPROM we found. |