summaryrefslogtreecommitdiffstats
path: root/sys/kern/subr_bus.c
diff options
context:
space:
mode:
authordfr <dfr@FreeBSD.org>1999-05-14 09:13:43 +0000
committerdfr <dfr@FreeBSD.org>1999-05-14 09:13:43 +0000
commit31a93d7badb7cdb6ebdade2dd9407d424ad888c0 (patch)
tree55de983ba29fa8e218e64da7268356dea76eb32f /sys/kern/subr_bus.c
parentdadd91f60975a77f24b56f7ee8025e21c863e7a2 (diff)
downloadFreeBSD-src-31a93d7badb7cdb6ebdade2dd9407d424ad888c0.zip
FreeBSD-src-31a93d7badb7cdb6ebdade2dd9407d424ad888c0.tar.gz
Adjust method dispatch to ensure that default methods are called properly.
Diffstat (limited to 'sys/kern/subr_bus.c')
-rw-r--r--sys/kern/subr_bus.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/sys/kern/subr_bus.c b/sys/kern/subr_bus.c
index 8224b4a..bdfead6 100644
--- a/sys/kern/subr_bus.c
+++ b/sys/kern/subr_bus.c
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: subr_bus.c,v 1.20 1999/05/08 21:59:35 dfr Exp $
+ * $Id: subr_bus.c,v 1.21 1999/05/10 17:06:14 dfr Exp $
*/
#include <sys/param.h>
@@ -93,6 +93,7 @@ static void device_unregister_oids(device_t dev);
/*
* Method table handling
*/
+static int error_method(void);
static int next_method_offset = 1;
LIST_HEAD(methodlist, method) methods;
@@ -114,6 +115,12 @@ register_method(struct device_op_desc *desc)
return;
}
+ /*
+ * Make sure that desc->deflt is always valid to simplify dispatch.
+ */
+ if (!desc->deflt)
+ desc->deflt = error_method;
+
for (m = LIST_FIRST(&methods); m; m = LIST_NEXT(m, link)) {
if (!strcmp(m->name, desc->name)) {
desc->offset = m->offset;
OpenPOWER on IntegriCloud