From 64e043166ea273be74bd17b2ec9bffd43013191b Mon Sep 17 00:00:00 2001 From: Warner Losh Date: Wed, 22 Nov 2006 06:03:39 +0000 Subject: [PATCH] copyout on read, not write. Tweak a comment while I'm here. --- sys/dev/iicbus/iic.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/dev/iicbus/iic.c b/sys/dev/iicbus/iic.c index b50d2e087204..3d3f28f4498e 100644 --- a/sys/dev/iicbus/iic.c +++ b/sys/dev/iicbus/iic.c @@ -306,7 +306,7 @@ iicioctl(struct cdev *dev, u_long cmd, caddr_t data, int flags, struct thread *t error = copyin(d->msgs, buf, sizeof(*d->msgs) * d->nmsgs); if (error) break; - /* Allocate kernel buffers for userland data, copyin write data */ + /* Alloc kernel buffers for userland data, copyin write data */ for (i = 0; i < d->nmsgs; i++) { m = &((struct iic_msg *)buf)[i]; usrbufs[i] = m->buf; @@ -318,7 +318,7 @@ iicioctl(struct cdev *dev, u_long cmd, caddr_t data, int flags, struct thread *t /* Copyout all read segments, free up kernel buffers */ for (i = 0; i < d->nmsgs; i++) { m = &((struct iic_msg *)buf)[i]; - if (!(m->flags & IIC_M_RD)) + if (m->flags & IIC_M_RD) copyout(m->buf, usrbufs[i], m->len); free(m->buf, M_TEMP); }