From 38dd9cda0ae564bb34f57c2a3963465041bbf372 Mon Sep 17 00:00:00 2001 From: Damien Bergamini Date: Fri, 19 Feb 2010 17:00:57 +0000 Subject: fix run_set_region_4 to set the whole region specified, not a quarter of it! --- sys/dev/usb/if_run.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'sys/dev') diff --git a/sys/dev/usb/if_run.c b/sys/dev/usb/if_run.c index af2e5ea41a4..06360a08396 100644 --- a/sys/dev/usb/if_run.c +++ b/sys/dev/usb/if_run.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_run.c,v 1.57 2010/02/10 21:46:56 damien Exp $ */ +/* $OpenBSD: if_run.c,v 1.58 2010/02/19 17:00:56 damien Exp $ */ /*- * Copyright (c) 2008-2010 Damien Bergamini @@ -842,13 +842,12 @@ run_write_region_1(struct run_softc *sc, uint16_t reg, const uint8_t *buf, } int -run_set_region_4(struct run_softc *sc, uint16_t reg, uint32_t val, int len) +run_set_region_4(struct run_softc *sc, uint16_t reg, uint32_t val, int count) { - int i, error = 0; + int error = 0; - KASSERT((len & 3) == 0); - for (i = 0; i < len && error == 0; i += 4) - error = run_write(sc, reg + i, val); + for (; count > 0 && error == 0; count--, reg += 4) + error = run_write(sc, reg, val); return error; } -- cgit v1.2.3