From bfb0fb5dce3cf833ba1520004080a2f8e2b5a970 Mon Sep 17 00:00:00 2001 From: Jonathan Gray Date: Fri, 12 Dec 2008 23:38:24 +0000 Subject: Check for zero'd spd data even if we pass the checksum and don't offer a match in this case. Deals with the qemu "TODO: Populate SPD eeprom data." tested by todd@ --- sys/dev/i2c/i2c_scan.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sys/dev/i2c/i2c_scan.c b/sys/dev/i2c/i2c_scan.c index 01cd5885f72..601d20ec510 100644 --- a/sys/dev/i2c/i2c_scan.c +++ b/sys/dev/i2c/i2c_scan.c @@ -1,4 +1,4 @@ -/* $OpenBSD: i2c_scan.c,v 1.128 2008/11/13 17:57:15 deraadt Exp $ */ +/* $OpenBSD: i2c_scan.c,v 1.129 2008/12/12 23:38:23 jsg Exp $ */ /* * Copyright (c) 2005 Theo de Raadt @@ -927,10 +927,12 @@ char * iic_probe_eeprom(struct device *self, u_int8_t addr) { int reg, csum = 0; + u_int8_t size; char *name = NULL; /* SPD EEPROMs should only set lower nibble for size (ie <= 32K) */ - if ((iicprobe(0x01) & 0xf0) != 0) + size = iicprobe(0x01); + if (((size & 0xf0) != 0) || size == 0) return (name); for (reg = 0; reg < 0x3f; reg++) -- cgit v1.2.3