Searched hist:212544 (Results 1 - 1 of 1) sorted by relevance

/freebsd-10.0-release/sys/kern/
H A Dbus_if.mdiff 212544 Mon Sep 13 06:47:38 MDT 2010 avg bus_add_child: add specialized default implementation that calls panic

If a kobj method doesn't have any explicitly provided default
implementation, then it is auto-assigned kobj_error_method.
kobj_error_method is proper only for methods that return error code,
because it just returns ENXIO.
So, in the case of unimplemented bus_add_child caller would get
(device_t)ENXIO as a return value, which would cause the mistake to go
unnoticed, because return value is typically checked for NULL.
Thus, a specialized null_add_child is added. It would have sufficied
for correctness to return NULL, but this type of mistake was deemed to
be rare and serious enough to call panic instead.

Watch out for this kind of problem with other kobj methods.

Suggested by: jhb, imp
MFC after: 2 weeks

Completed in 73 milliseconds