summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorKenji Aoyama <aoyama@cvs.openbsd.org>2017-03-15 11:13:35 +0000
committerKenji Aoyama <aoyama@cvs.openbsd.org>2017-03-15 11:13:35 +0000
commitf880e5e8ae2fce1bd5e98f77665a7fbc87ac2932 (patch)
tree67a6ad5d99b44f265f6e02621f699630f3066941 /sys
parentea14574647336b1ec9d14438d1845d8e20e3180c (diff)
We do not need while loop around uiomove(9) in lcdwrite().
Pointed out by Enami Tsugutomo while porting this driver to NetBSD/luna68k by Izumi Tsutsui. Tested by me.
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/luna88k/dev/lcd.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/sys/arch/luna88k/dev/lcd.c b/sys/arch/luna88k/dev/lcd.c
index bec431b990d..086a859ff72 100644
--- a/sys/arch/luna88k/dev/lcd.c
+++ b/sys/arch/luna88k/dev/lcd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lcd.c,v 1.7 2015/02/10 22:42:35 miod Exp $ */
+/* $OpenBSD: lcd.c,v 1.8 2017/03/15 11:13:34 aoyama Exp $ */
/* $NetBSD: lcd.c,v 1.2 2000/01/07 05:13:08 nisimura Exp $ */
/*-
@@ -163,21 +163,17 @@ int
lcdwrite(dev_t dev, struct uio *uio, int flag)
{
int error;
- size_t len;
- size_t i, n;
+ size_t len, i;
char buf[LCD_MAXBUFLEN];
- len = n = uio->uio_resid;
+ len = uio->uio_resid;
if (len > LCD_MAXBUFLEN)
return EIO;
- while (n > 0) {
- error = uiomove(buf, n, uio);
- if (error)
- return EIO;
- n = uio->uio_resid;
- }
+ error = uiomove(buf, len, uio);
+ if (error)
+ return EIO;
for (i = 0; i < len; i++) {
lcdput((int)buf[i]);