Commit 14e9c839 authored by Dave Jones's avatar Dave Jones Committed by Dave Jones

[PATCH] plug leaks in aic79xx

Spotted with the source checker from Coverity.com.
Signed-off-by: default avatarDave Jones <davej@redhat.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent 0886f5e6
...@@ -1560,6 +1560,8 @@ ahd_linux_dev_reset(Scsi_Cmnd *cmd) ...@@ -1560,6 +1560,8 @@ ahd_linux_dev_reset(Scsi_Cmnd *cmd)
ahd = *(struct ahd_softc **)cmd->device->host->hostdata; ahd = *(struct ahd_softc **)cmd->device->host->hostdata;
recovery_cmd = malloc(sizeof(struct scsi_cmnd), M_DEVBUF, M_WAITOK); recovery_cmd = malloc(sizeof(struct scsi_cmnd), M_DEVBUF, M_WAITOK);
if (!recovery_cmd)
return (FAILED);
memset(recovery_cmd, 0, sizeof(struct scsi_cmnd)); memset(recovery_cmd, 0, sizeof(struct scsi_cmnd));
recovery_cmd->device = cmd->device; recovery_cmd->device = cmd->device;
recovery_cmd->scsi_done = ahd_linux_dev_reset_complete; recovery_cmd->scsi_done = ahd_linux_dev_reset_complete;
...@@ -1575,10 +1577,12 @@ ahd_linux_dev_reset(Scsi_Cmnd *cmd) ...@@ -1575,10 +1577,12 @@ ahd_linux_dev_reset(Scsi_Cmnd *cmd)
cmd->device->lun, /*alloc*/FALSE); cmd->device->lun, /*alloc*/FALSE);
if (dev == NULL) { if (dev == NULL) {
ahd_midlayer_entrypoint_unlock(ahd, &s); ahd_midlayer_entrypoint_unlock(ahd, &s);
kfree(recovery_cmd);
return (FAILED); return (FAILED);
} }
if ((scb = ahd_get_scb(ahd, AHD_NEVER_COL_IDX)) == NULL) { if ((scb = ahd_get_scb(ahd, AHD_NEVER_COL_IDX)) == NULL) {
ahd_midlayer_entrypoint_unlock(ahd, &s); ahd_midlayer_entrypoint_unlock(ahd, &s);
kfree(recovery_cmd);
return (FAILED); return (FAILED);
} }
tinfo = ahd_fetch_transinfo(ahd, 'A', ahd->our_id, tinfo = ahd_fetch_transinfo(ahd, 'A', ahd->our_id,
...@@ -1773,6 +1777,7 @@ ahd_dmamem_alloc(struct ahd_softc *ahd, bus_dma_tag_t dmat, void** vaddr, ...@@ -1773,6 +1777,7 @@ ahd_dmamem_alloc(struct ahd_softc *ahd, bus_dma_tag_t dmat, void** vaddr,
if (ahd->dev_softc != NULL) if (ahd->dev_softc != NULL)
if (ahd_pci_set_dma_mask(ahd->dev_softc, 0xFFFFFFFF)) { if (ahd_pci_set_dma_mask(ahd->dev_softc, 0xFFFFFFFF)) {
printk(KERN_WARNING "aic79xx: No suitable DMA available.\n"); printk(KERN_WARNING "aic79xx: No suitable DMA available.\n");
kfree(map);
return (ENODEV); return (ENODEV);
} }
*vaddr = pci_alloc_consistent(ahd->dev_softc, *vaddr = pci_alloc_consistent(ahd->dev_softc,
...@@ -1781,6 +1786,7 @@ ahd_dmamem_alloc(struct ahd_softc *ahd, bus_dma_tag_t dmat, void** vaddr, ...@@ -1781,6 +1786,7 @@ ahd_dmamem_alloc(struct ahd_softc *ahd, bus_dma_tag_t dmat, void** vaddr,
if (ahd_pci_set_dma_mask(ahd->dev_softc, if (ahd_pci_set_dma_mask(ahd->dev_softc,
ahd->platform_data->hw_dma_mask)) { ahd->platform_data->hw_dma_mask)) {
printk(KERN_WARNING "aic79xx: No suitable DMA available.\n"); printk(KERN_WARNING "aic79xx: No suitable DMA available.\n");
kfree(map);
return (ENODEV); return (ENODEV);
} }
#else /* LINUX_VERSION_CODE < KERNEL_VERSION(2,3,0) */ #else /* LINUX_VERSION_CODE < KERNEL_VERSION(2,3,0) */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment