Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/net Reduce return points
details: https://anonhg.NetBSD.org/src/rev/3b5b6ff812b8
branches: trunk
changeset: 351065:3b5b6ff812b8
user: ozaki-r <ozaki-r%NetBSD.org@localhost>
date: Wed Feb 01 08:18:33 2017 +0000
description:
Reduce return points
diffstat:
sys/net/bpf.c | 26 +++++++++++---------------
1 files changed, 11 insertions(+), 15 deletions(-)
diffs (73 lines):
diff -r d8b3d2f7c34c -r 3b5b6ff812b8 sys/net/bpf.c
--- a/sys/net/bpf.c Wed Feb 01 08:16:42 2017 +0000
+++ b/sys/net/bpf.c Wed Feb 01 08:18:33 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bpf.c,v 1.211 2017/02/01 08:16:42 ozaki-r Exp $ */
+/* $NetBSD: bpf.c,v 1.212 2017/02/01 08:18:33 ozaki-r Exp $ */
/*
* Copyright (c) 1990, 1991, 1993
@@ -39,7 +39,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bpf.c,v 1.211 2017/02/01 08:16:42 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bpf.c,v 1.212 2017/02/01 08:18:33 ozaki-r Exp $");
#if defined(_KERNEL_OPT)
#include "opt_bpf.h"
@@ -632,9 +632,8 @@
while (d->bd_hbuf == NULL) {
if (fp->f_flag & FNONBLOCK) {
if (d->bd_slen == 0) {
- splx(s);
- KERNEL_UNLOCK_ONE(NULL);
- return (EWOULDBLOCK);
+ error = EWOULDBLOCK;
+ goto out;
}
ROTATE_BUFFERS(d);
break;
@@ -654,11 +653,9 @@
error = cv_timedwait_sig(&d->bd_cv, d->bd_mtx, d->bd_rtout);
mutex_exit(d->bd_mtx);
- if (error == EINTR || error == ERESTART) {
- splx(s);
- KERNEL_UNLOCK_ONE(NULL);
- return (error);
- }
+ if (error == EINTR || error == ERESTART)
+ goto out;
+
if (error == EWOULDBLOCK) {
/*
* On a timeout, return what's in the buffer,
@@ -674,15 +671,14 @@
break;
if (d->bd_slen == 0) {
- splx(s);
- KERNEL_UNLOCK_ONE(NULL);
- return (0);
+ error = 0;
+ goto out;
}
ROTATE_BUFFERS(d);
break;
}
if (error != 0)
- goto done;
+ goto out;
}
/*
* At this point, we know we have something in the hold slot.
@@ -700,7 +696,7 @@
d->bd_fbuf = d->bd_hbuf;
d->bd_hbuf = NULL;
d->bd_hlen = 0;
-done:
+out:
splx(s);
KERNEL_UNLOCK_ONE(NULL);
return (error);
Home |
Main Index |
Thread Index |
Old Index