A pointer was checked for NULL after dereferencing it. The check is not

needed here, except there's a bug which results in detaching the device
twice.

Move the NULL pointer check to the beginning of the function and convert
it into a KASSERT.

CID:		420
Found with:	Coverity Prevent(tm)
Discussed with:	ariff
MFC after:	5 days
This commit is contained in:
Alexander Leidinger 2006-02-05 17:33:18 +00:00
parent 5bba2114d0
commit cd9de7ee61

View file

@ -722,6 +722,8 @@ csa_releaseres(struct csa_info *csa, device_t dev)
{
csa_res *resp;
KASSERT(csa != NULL, ("called with bogus resource structure"));
resp = &csa->res;
if (resp->irq != NULL) {
if (csa->ih)
@ -741,10 +743,8 @@ csa_releaseres(struct csa_info *csa, device_t dev)
bus_dma_tag_destroy(csa->parent_dmat);
csa->parent_dmat = NULL;
}
if (csa != NULL) {
free(csa, M_DEVBUF);
csa = NULL;
}
free(csa, M_DEVBUF);
}
static int