From b5f516cdaf5da6ca16054283915e6426c66b135d Mon Sep 17 00:00:00 2001 From: Scott Long Date: Sat, 19 Mar 2005 06:29:32 +0000 Subject: [PATCH] Handle failures better in the passthrough bus creation code. Submitted by: Coverity Prevent analysis tool --- sys/dev/aac/aac.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/sys/dev/aac/aac.c b/sys/dev/aac/aac.c index 35b5d6418adf..79ca57d19e69 100644 --- a/sys/dev/aac/aac.c +++ b/sys/dev/aac/aac.c @@ -54,6 +54,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -3019,13 +3020,19 @@ aac_get_bus_info(struct aac_softc *sc) caminf = (struct aac_sim *)malloc( sizeof(struct aac_sim), M_AACBUF, M_NOWAIT | M_ZERO); - if (caminf == NULL) - continue; + if (caminf == NULL) { + device_printf(sc->aac_dev, + "No memory to add passthrough bus %d\n", i); + break; + } child = device_add_child(sc->aac_dev, "aacp", -1); if (child == NULL) { - device_printf(sc->aac_dev, "device_add_child failed\n"); - continue; + device_printf(sc->aac_dev, + "device_add_child failed for passthrough bus %d\n", + i); + free(caminf, M_AACBUF); + break; } caminf->TargetsPerBus = businfo.TargetsPerBus;