Avoid NULL pointer dereference on power handler deregistration if
it was not registered before. I assume that a lot of drivers do not proper bookkeeping in the case the attach() exits early due to errors. This is hard to fix and to test, so just be generous here.
This commit is contained in:
parent
3126a6b09b
commit
a17262c3e3
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: subr_autoconf.c,v 1.156 2008/06/11 15:56:11 drochner Exp $ */
|
||||
/* $NetBSD: subr_autoconf.c,v 1.157 2008/07/28 14:22:14 drochner Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996, 2000 Christopher G. Demetriou
|
||||
@ -77,7 +77,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: subr_autoconf.c,v 1.156 2008/06/11 15:56:11 drochner Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: subr_autoconf.c,v 1.157 2008/07/28 14:22:14 drochner Exp $");
|
||||
|
||||
#include "opt_ddb.h"
|
||||
#include "drvctl.h"
|
||||
@ -2113,6 +2113,10 @@ device_pmf_driver_deregister(device_t dev)
|
||||
{
|
||||
pmf_private_t *pp = dev->dv_pmf_private;
|
||||
|
||||
/* XXX avoid crash in case we are not initialized */
|
||||
if (!pp)
|
||||
return;
|
||||
|
||||
dev->dv_driver_suspend = NULL;
|
||||
dev->dv_driver_resume = NULL;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user