diff options
Diffstat (limited to 'sys/rump')
| -rw-r--r-- | sys/rump/net/lib/libshmif/if_shmem.c | 20 | ||||
| -rw-r--r-- | sys/rump/net/lib/libvirtif/if_virt.c | 17 |
2 files changed, 10 insertions, 27 deletions
diff --git a/sys/rump/net/lib/libshmif/if_shmem.c b/sys/rump/net/lib/libshmif/if_shmem.c index acd7085662f..ab32753f9d9 100644 --- a/sys/rump/net/lib/libshmif/if_shmem.c +++ b/sys/rump/net/lib/libshmif/if_shmem.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_shmem.c,v 1.81 2020/02/25 03:26:18 ozaki-r Exp $ */ +/* $NetBSD: if_shmem.c,v 1.82 2021/06/16 00:21:19 riastradh Exp $ */ /* * Copyright (c) 2009, 2010 Antti Kantee. All Rights Reserved. @@ -28,7 +28,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_shmem.c,v 1.81 2020/02/25 03:26:18 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_shmem.c,v 1.82 2021/06/16 00:21:19 riastradh Exp $"); #include <sys/param.h> #include <sys/atomic.h> @@ -164,7 +164,7 @@ allocif(int unit, struct shmif_sc **scp) struct shmif_sc *sc; struct ifnet *ifp; uint64_t randnum; - int error; + int error = 0; randnum = cprng_strong64(); memcpy(&enaddr[2], &randnum, 4); @@ -195,16 +195,7 @@ allocif(int unit, struct shmif_sc **scp) mutex_init(&sc->sc_mtx, MUTEX_DEFAULT, IPL_NONE); cv_init(&sc->sc_cv, "shmifcv"); - error = if_initialize(ifp); - if (error != 0) { - aprint_error("shmif%d: if_initialize failed(%d)\n", unit, - error); - cv_destroy(&sc->sc_cv); - mutex_destroy(&sc->sc_mtx); - kmem_free(sc, sizeof(*sc)); - - return error; - } + if_initialize(ifp); #if 1 char buf[256]; @@ -224,7 +215,6 @@ allocif(int unit, struct shmif_sc **scp) if (scp) *scp = sc; - error = 0; if (rump_threads) { error = kthread_create(PRI_NONE, KTHREAD_MPSAFE | KTHREAD_MUSTJOIN, NULL, @@ -237,7 +227,7 @@ allocif(int unit, struct shmif_sc **scp) shmif_unclone(ifp); } - return error; + return 0; } static int diff --git a/sys/rump/net/lib/libvirtif/if_virt.c b/sys/rump/net/lib/libvirtif/if_virt.c index 5406ea956bd..46800769879 100644 --- a/sys/rump/net/lib/libvirtif/if_virt.c +++ b/sys/rump/net/lib/libvirtif/if_virt.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_virt.c,v 1.58 2020/02/01 22:45:01 thorpej Exp $ */ +/* $NetBSD: if_virt.c,v 1.59 2021/06/16 00:21:20 riastradh Exp $ */ /* * Copyright (c) 2008, 2013 Antti Kantee. All Rights Reserved. @@ -26,7 +26,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_virt.c,v 1.58 2020/02/01 22:45:01 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_virt.c,v 1.59 2021/06/16 00:21:20 riastradh Exp $"); #include <sys/param.h> #include <sys/kernel.h> @@ -121,13 +121,7 @@ virtif_clone(struct if_clone *ifc, int num) ifp->if_mtu = ETHERMTU; ifp->if_dlt = DLT_EN10MB; - error = if_initialize(ifp); - if (error != 0) { - aprint_error("%s: if_initialize failed(%d)\n", ifp->if_xname, - error); - goto fail_1; - } - + if_initialize(ifp); if_register(ifp); #ifndef RUMP_VIF_LINKSTR @@ -140,17 +134,16 @@ virtif_clone(struct if_clone *ifc, int num) sc->sc_linkstr = kmem_alloc(LINKSTRNUMLEN, KM_SLEEP); if (sc->sc_linkstr == NULL) { error = ENOMEM; - goto fail_2; + goto fail; } snprintf(sc->sc_linkstr, LINKSTRNUMLEN, "%d", sc->sc_num); error = virtif_create(ifp); if (error) { -fail_2: +fail: if_detach(ifp); if (sc->sc_linkstr != NULL) kmem_free(sc->sc_linkstr, LINKSTRNUMLEN); #undef LINKSTRNUMLEN -fail_1: kmem_free(sc, sizeof(*sc)); ifp->if_softc = NULL; } |
