Module Name:    src
Committed By:   pgoyette
Date:           Sun Dec 17 21:57:11 UTC 2017

Modified Files:
        src/sys/dev/pad: pad.c

Log Message:
If config_fini_component() fails (due to device driver busy), don't
discard its error value when re-attaching the devsw.  If the devsw
is successfully re-attached and we return success, the module will
get detached anyway.  And, since the device is actually busy, we'll
eventually panic.

Thanks to nat@ for providing the reproduction instructions.

XXX A driver-busy condition will currently still trigger the error
XXX message from config_fini_component()
XXX     configure: attachment `pad' of `pad' driver fini failed: 16
XXX This will be addresses separately by having pad maintain its own
XXX ref-count and not relying on config_fini_component() to detect
XXX the busy state.


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/sys/dev/pad/pad.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/pad/pad.c
diff -u src/sys/dev/pad/pad.c:1.48 src/sys/dev/pad/pad.c:1.49
--- src/sys/dev/pad/pad.c:1.48	Sat Dec 16 06:39:07 2017
+++ src/sys/dev/pad/pad.c	Sun Dec 17 21:57:11 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: pad.c,v 1.48 2017/12/16 06:39:07 pgoyette Exp $ */
+/* $NetBSD: pad.c,v 1.49 2017/12/17 21:57:11 pgoyette Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill <jmcne...@invisible.ca>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pad.c,v 1.48 2017/12/16 06:39:07 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pad.c,v 1.49 2017/12/17 21:57:11 pgoyette Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -955,7 +955,7 @@ pad_modcmd(modcmd_t cmd, void *arg)
 		error = config_fini_component(cfdriver_ioconf_pad,
 		    pad_cfattach, cfdata_ioconf_pad);
 		if (error) {
-			error = devsw_attach(pad_cd.cd_name, NULL, &bmajor,
+			devsw_attach(pad_cd.cd_name, NULL, &bmajor,
 			    &pad_cdevsw, &cmajor);
 			break;
 		}

Reply via email to