diff options
author | netchild <netchild@FreeBSD.org> | 2006-02-05 17:33:18 +0000 |
---|---|---|
committer | netchild <netchild@FreeBSD.org> | 2006-02-05 17:33:18 +0000 |
commit | cc33bd5ae69a685c1b5fd1600d0d0de32d30010b (patch) | |
tree | 63abacba56dfe170cc523782cb22495250dc081e | |
parent | 0c9bbeed735fcdda1e73ad11a546291ac7cd0f38 (diff) | |
download | FreeBSD-src-cc33bd5ae69a685c1b5fd1600d0d0de32d30010b.zip FreeBSD-src-cc33bd5ae69a685c1b5fd1600d0d0de32d30010b.tar.gz |
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
-rw-r--r-- | sys/dev/sound/pci/csapcm.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/sys/dev/sound/pci/csapcm.c b/sys/dev/sound/pci/csapcm.c index 2850c29..2908d38 100644 --- a/sys/dev/sound/pci/csapcm.c +++ b/sys/dev/sound/pci/csapcm.c @@ -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 |