diff options
author | mdf <mdf@FreeBSD.org> | 2010-09-09 18:35:08 +0000 |
---|---|---|
committer | mdf <mdf@FreeBSD.org> | 2010-09-09 18:35:08 +0000 |
commit | 4d6392f9c43a18d9ddc828a039807d9fb4a11faf (patch) | |
tree | 9e317a68725413b9233906c12954a029c8df8959 /sys/dev/led | |
parent | bc5468425338dbee3cd3da7d6bc2a1290ba8d2ce (diff) | |
download | FreeBSD-src-4d6392f9c43a18d9ddc828a039807d9fb4a11faf.zip FreeBSD-src-4d6392f9c43a18d9ddc828a039807d9fb4a11faf.tar.gz |
Fix an incorrect use of sbuf_overflowed() after a call to sbuf_finish().
Diffstat (limited to 'sys/dev/led')
-rw-r--r-- | sys/dev/led/led.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/sys/dev/led/led.c b/sys/dev/led/led.c index fdd0fa2..521006c 100644 --- a/sys/dev/led/led.c +++ b/sys/dev/led/led.c @@ -220,15 +220,11 @@ led_write(struct cdev *dev, struct uio *uio, int ioflag) free(s2, M_DEVBUF); return (EINVAL); } - sbuf_finish(sb); + error = sbuf_finish(sb); free(s2, M_DEVBUF); - if (sbuf_overflowed(sb)) { + if (error != 0 || sbuf_len(sb) == 0) { sbuf_delete(sb); - return (ENOMEM); - } - if (sbuf_len(sb) == 0) { - sbuf_delete(sb); - return (0); + return (error); } return (led_state(dev, sb, 0)); |