qla4xxx: check the return value of dma_alloc_coherent()
authorMaurizio Lombardi <mlombard@redhat.com>
Mon, 28 Jul 2014 12:55:27 +0000 (14:55 +0200)
committerChristoph Hellwig <hch@lst.de>
Wed, 30 Jul 2014 11:49:37 +0000 (07:49 -0400)
the qla4xxx_alloc_fw_dump() calls dma_alloc_coherent() but does not
check its return value.

Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
Acked-By: Nilesh Javali <nilesh.javali@qlogic.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/scsi/qla4xxx/ql4_init.c

index 6f12f859b11db787e3b8add134f4d7515cf5ecf4..4180d6d9fe782460d1e09b8d5aa70b9a003c862a 100644 (file)
@@ -334,6 +334,12 @@ void qla4xxx_alloc_fw_dump(struct scsi_qla_host *ha)
        /* Allocate memory for saving the template */
        md_tmp = dma_alloc_coherent(&ha->pdev->dev, ha->fw_dump_tmplt_size,
                                    &md_tmp_dma, GFP_KERNEL);
+       if (!md_tmp) {
+               ql4_printk(KERN_INFO, ha,
+                          "scsi%ld: Failed to allocate DMA memory\n",
+                          ha->host_no);
+               return;
+       }
 
        /* Request template */
        status =  qla4xxx_get_minidump_template(ha, md_tmp_dma);
This page took 0.026039 seconds and 5 git commands to generate.