use device_lookup to get device

This commit is contained in:
cegger 2008-06-13 14:25:06 +00:00
parent 5293e6ad9f
commit 7e0f2eede2
1 changed files with 8 additions and 5 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_tap_lkm.c,v 1.6 2008/04/29 06:53:03 martin Exp $ */ /* $NetBSD: if_tap_lkm.c,v 1.7 2008/06/13 14:25:06 cegger Exp $ */
/* /*
* Copyright (c) 2003, 2004, 2005 The NetBSD Foundation. * Copyright (c) 2003, 2004, 2005 The NetBSD Foundation.
@ -42,7 +42,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_tap_lkm.c,v 1.6 2008/04/29 06:53:03 martin Exp $"); __KERNEL_RCSID(0, "$NetBSD: if_tap_lkm.c,v 1.7 2008/06/13 14:25:06 cegger Exp $");
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
@ -158,13 +158,16 @@ static int
tap_lkmunload(struct lkm_table *lkmtp, int cmd) tap_lkmunload(struct lkm_table *lkmtp, int cmd)
{ {
int error, i; int error, i;
device_t dev;
if_clone_detach(&tap_cloners); if_clone_detach(&tap_cloners);
for (i = 0; i < tap_cd.cd_ndevs; i++) for (i = 0; i < tap_cd.cd_ndevs; i++) {
if (tap_cd.cd_devs[i] != NULL && dev = device_lookup(&tap_cd, i);
(error = tap_clone_destroyer(tap_cd.cd_devs[i])) != 0) if (dev != NULL &&
(error = tap_clone_destroyer(dev)) != 0)
return error; return error;
}
sysctl_teardown(&tap_log); sysctl_teardown(&tap_log);