freebsd11_network: Handle NULL gracefully instead of faulting.
FreeBSD does not have these checks, but drivers seem to expect that they can call these functions with NULL and not crash. Fixes a number of boot-failure tickets (and makes it possible for me at least to test drivers without rebooting from KDL every failure), though of course the drivers themselves will still not work.
This commit is contained in:
@@ -212,6 +212,11 @@ _callout_stop_safe(struct callout *c, int safe)
|
||||
{
|
||||
MutexLocker locker(sLock);
|
||||
|
||||
if (c == NULL) {
|
||||
printf("_callout_stop_safe called with NULL callout");
|
||||
return 0;
|
||||
}
|
||||
|
||||
TRACE("_callout_stop_safe %p, func %p, arg %p\n", c, c->c_func, c->c_arg);
|
||||
|
||||
if (c->due <= 0)
|
||||
|
||||
@@ -247,6 +247,11 @@ taskqueue_drain(struct taskqueue *taskQueue, struct task *task)
|
||||
{
|
||||
cpu_status status;
|
||||
|
||||
if (taskQueue == NULL) {
|
||||
printf("taskqueue_drain called with NULL taskqueue");
|
||||
return;
|
||||
}
|
||||
|
||||
tq_lock(taskQueue, &status);
|
||||
while (task->ta_pending != 0) {
|
||||
tq_unlock(taskQueue, status);
|
||||
|
||||
Reference in New Issue
Block a user