From 47402bab917cbc1c5a99e0175c76687367a2d322 Mon Sep 17 00:00:00 2001 From: "Justin T. Gibbs" Date: Thu, 16 Jul 1998 19:33:43 +0000 Subject: [PATCH] Correct SEEPROM checksum calculation when multiple checksum attemps are made. Pointed out by: "Jose M. Alcaide" --- sys/pci/aic7870.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/sys/pci/aic7870.c b/sys/pci/aic7870.c index c99a6fc2547f..044557682306 100644 --- a/sys/pci/aic7870.c +++ b/sys/pci/aic7870.c @@ -36,7 +36,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: aic7870.c,v 1.54 1997/11/18 14:14:34 bde Exp $ + * $Id: aic7870.c,v 1.55 1998/07/06 18:38:57 gibbs Exp $ */ #if defined(__FreeBSD__) @@ -676,7 +676,6 @@ load_seeprom(ahc, sxfrctl1) struct seeprom_descriptor sd; struct seeprom_config sc; u_int16_t *scarray = (u_int16_t *)≻ - u_int16_t checksum = 0; u_int8_t scsi_conf; u_int8_t host_id; int have_seeprom; @@ -726,8 +725,13 @@ load_seeprom(ahc, sxfrctl1) if (have_seeprom) { /* Check checksum */ int i; - int maxaddr = (sizeof(sc)/2) - 1; - u_int16_t *scarray = (u_int16_t *)≻ + int maxaddr; + u_int16_t *scarray; + u_int16_t checksum; + + maxaddr = (sizeof(sc)/2) - 1; + checksum = 0; + scarray = (u_int16_t *)≻ for (i = 0; i < maxaddr; i++) checksum = checksum + scarray[i];