From 31a93d7badb7cdb6ebdade2dd9407d424ad888c0 Mon Sep 17 00:00:00 2001 From: dfr Date: Fri, 14 May 1999 09:13:43 +0000 Subject: Adjust method dispatch to ensure that default methods are called properly. --- sys/kern/subr_bus.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'sys/kern/subr_bus.c') 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 @@ -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; -- cgit v1.1