diff options
author | Frank Schaefer <fschaefer.oss@googlemail.com> | 2013-03-03 15:37:37 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2013-03-04 15:48:58 -0300 |
commit | f55eacbe744f696fa5ff48fe4fdc0f00edc08619 (patch) | |
tree | 58edce55d71803a05e543d3e7189138aa7af2b06 /drivers | |
parent | d90f067713091f010672ddbd023691675a7b33ea (diff) |
[media] em28xx: do not interpret eeprom content if eeprom key is invalid
If the eeprom key isn't valid, either a different (currently unknown) format
is used or the eeprom is corrupted.
In both cases it doesn't make sense to interpret the data.
Also print an error message.
Signed-off-by: Frank Schäfer <fschaefer.oss@googlemail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/usb/em28xx/em28xx-i2c.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/media/usb/em28xx/em28xx-i2c.c b/drivers/media/usb/em28xx/em28xx-i2c.c index b8e9946f8452..b8a9bee836fa 100644 --- a/drivers/media/usb/em28xx/em28xx-i2c.c +++ b/drivers/media/usb/em28xx/em28xx-i2c.c @@ -434,8 +434,12 @@ static int em28xx_i2c_eeprom(struct em28xx *dev, unsigned char *eedata, int len) printk("\n"); } - if (em_eeprom->id == 0x9567eb1a) - dev->hash = em28xx_hash_mem(eedata, len, 32); + if (em_eeprom->id != 0x9567eb1a) { + em28xx_errdev("Unknown eeprom type or eeprom corrupted !"); + return -ENODEV; + } + + dev->hash = em28xx_hash_mem(eedata, len, 32); em28xx_info("EEPROM ID = 0x%08x, EEPROM hash = 0x%08lx\n", em_eeprom->id, dev->hash); |