From 6eb90f95247f3abd3ee514ac8d208d12977ed293 Mon Sep 17 00:00:00 2001 From: pgoyette Date: Sun, 17 Jul 2016 00:17:14 +0000 Subject: [PATCH] Rather than calling devsw_attach() and ignoring the EEXIST error when the driver is already built-in to the kernel, don't bother calling. --- sys/netsmb/smb_dev.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sys/netsmb/smb_dev.c b/sys/netsmb/smb_dev.c index 21db71d1fc8a..afd3125597ca 100644 --- a/sys/netsmb/smb_dev.c +++ b/sys/netsmb/smb_dev.c @@ -1,4 +1,4 @@ -/* $NetBSD: smb_dev.c,v 1.44 2015/08/20 14:40:19 christos Exp $ */ +/* $NetBSD: smb_dev.c,v 1.45 2016/07/17 00:17:14 pgoyette Exp $ */ /* * Copyright (c) 2000-2001 Boris Popov @@ -35,7 +35,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: smb_dev.c,v 1.44 2015/08/20 14:40:19 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: smb_dev.c,v 1.45 2016/07/17 00:17:14 pgoyette Exp $"); #include #include @@ -378,19 +378,23 @@ nsmb_modcmd(modcmd_t cmd, void *arg) switch (cmd) { case MODULE_CMD_INIT: nsmbattach(1); +#ifdef _MODULE error = devsw_attach("nsmb", NULL, &bmajor, &nsmb_cdevsw, &cmajor); if (error == EEXIST) /* builtin */ error = 0; +#endif if (error) { nsmbdetach(); } break; case MODULE_CMD_FINI: +#ifdef _MODULE error = devsw_detach(NULL, &nsmb_cdevsw); if (error) break; +#endif nsmbdetach(); break; default: