]> git.hungrycats.org Git - linux/commitdiff
[PATCH] Clean up failure path in DAC960
authorDave Jones <davej@redhat.com>
Thu, 2 Sep 2004 07:37:17 +0000 (00:37 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Thu, 2 Sep 2004 07:37:17 +0000 (00:37 -0700)
1. If the ScatterGatherPool allocation fails, its pointless
   trying to allocate a RequestSensePool.
2. Free up the ScatterGatherPool if the RequestSensePool allocation fails.

Spotted with the source checker from Coverity.com.

Signed-off-by: Dave Jones <davej@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
drivers/block/DAC960.c

index 56b9ce97c9b7aad2a8f61e33703935117faec359..5b908e64aa2297f15edfc36d816676f38ce5631d 100644 (file)
@@ -288,12 +288,17 @@ static boolean DAC960_CreateAuxiliaryStructures(DAC960_Controller_T *Controller)
                Controller->PCIDevice,
        DAC960_V2_ScatterGatherLimit * sizeof(DAC960_V2_ScatterGatherSegment_T),
        sizeof(DAC960_V2_ScatterGatherSegment_T), 0);
+      if (ScatterGatherPool == NULL)
+           return DAC960_Failure(Controller,
+                       "AUXILIARY STRUCTURE CREATION (SG)");
       RequestSensePool = pci_pool_create("DAC960_V2_RequestSense",
                Controller->PCIDevice, sizeof(DAC960_SCSI_RequestSense_T),
                sizeof(int), 0);
-      if (ScatterGatherPool == NULL || RequestSensePool == NULL)
+      if (RequestSensePool == NULL) {
+           pci_pool_destroy(ScatterGatherPool);
            return DAC960_Failure(Controller,
                        "AUXILIARY STRUCTURE CREATION (SG)");
+      }
       Controller->ScatterGatherPool = ScatterGatherPool;
       Controller->V2.RequestSensePool = RequestSensePool;
     }