aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/xen
diff options
context:
space:
mode:
authorRoger Pau Monné <royger@FreeBSD.org>2020-05-20 11:01:10 +0000
committerRoger Pau Monné <royger@FreeBSD.org>2020-05-20 11:01:10 +0000
commitb5ba8a0f32b1094f172699abf9bf70779a2158d5 (patch)
tree8cbbc92e72cdfae690df39919532e075d1f479bc /sys/dev/xen
parent22d1b05c8c37a0c9c7b391492ccd0c60835d9ea1 (diff)
Notes
Diffstat (limited to 'sys/dev/xen')
-rw-r--r--sys/dev/xen/evtchn/evtchn_dev.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/sys/dev/xen/evtchn/evtchn_dev.c b/sys/dev/xen/evtchn/evtchn_dev.c
index 9612b677f82b..fd8e290431ba 100644
--- a/sys/dev/xen/evtchn/evtchn_dev.c
+++ b/sys/dev/xen/evtchn/evtchn_dev.c
@@ -261,9 +261,10 @@ evtchn_read(struct cdev *dev, struct uio *uio, int ioflag)
sx_xlock(&u->ring_cons_mutex);
for (;;) {
- error = EFBIG;
- if (u->ring_overflow)
+ if (u->ring_overflow) {
+ error = EFBIG;
goto unlock_out;
+ }
c = u->ring_cons;
p = u->ring_prod;
@@ -271,13 +272,13 @@ evtchn_read(struct cdev *dev, struct uio *uio, int ioflag)
break;
if (ioflag & IO_NDELAY) {
- sx_xunlock(&u->ring_cons_mutex);
- return (EWOULDBLOCK);
+ error = EWOULDBLOCK;
+ goto unlock_out;
}
error = sx_sleep(u, &u->ring_cons_mutex, PCATCH, "evtchw", 0);
if ((error != 0) && (error != EWOULDBLOCK))
- return (error);
+ goto unlock_out;
}
/* Byte lengths of two chunks. Chunk split (if any) is at ring wrap. */