Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/pad If config_fini_component() fails (due to device ...



details:   https://anonhg.NetBSD.org/src/rev/a52034a27f8d
branches:  trunk
changeset: 828518:a52034a27f8d
user:      pgoyette <pgoyette%NetBSD.org@localhost>
date:      Sun Dec 17 21:57:11 2017 +0000

description:
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.

diffstat:

 sys/dev/pad/pad.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r f3f851846949 -r a52034a27f8d sys/dev/pad/pad.c
--- a/sys/dev/pad/pad.c Sun Dec 17 21:28:52 2017 +0000
+++ b/sys/dev/pad/pad.c Sun Dec 17 21:57:11 2017 +0000
@@ -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 <jmcneill%invisible.ca@localhost>
@@ -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 @@
                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;
                }



Home | Main Index | Thread Index | Old Index