scsi: qla4xxx: Use dma_pool_zalloc()
authorSouptick Joarder <jrdr.linux@gmail.com>
Wed, 14 Feb 2018 19:00:20 +0000 (00:30 +0530)
committerMartin K. Petersen <martin.petersen@oracle.com>
Thu, 22 Feb 2018 03:34:43 +0000 (22:34 -0500)
Use dma_pool_zalloc() instead of dma_pool_alloc + memset

Signed-off-by: Souptick Joarder <jrdr.linux@gmail.com>
Acked-by: Manish Rangankar <Manish.Rangankar@cavium.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/qla4xxx/ql4_mbx.c
drivers/scsi/qla4xxx/ql4_os.c

index bda2e64ee5ca4e3b528b7274bb2548f21638af11..5d56904687b95b4ae52f916d9277ee224798128c 100644 (file)
@@ -1584,12 +1584,11 @@ int qla4xxx_get_chap(struct scsi_qla_host *ha, char *username, char *password,
        struct ql4_chap_table *chap_table;
        dma_addr_t chap_dma;
 
-       chap_table = dma_pool_alloc(ha->chap_dma_pool, GFP_KERNEL, &chap_dma);
+       chap_table = dma_pool_zalloc(ha->chap_dma_pool, GFP_KERNEL, &chap_dma);
        if (chap_table == NULL)
                return -ENOMEM;
 
        chap_size = sizeof(struct ql4_chap_table);
-       memset(chap_table, 0, chap_size);
 
        if (is_qla40XX(ha))
                offset = FLASH_CHAP_OFFSET | (idx * chap_size);
@@ -1648,13 +1647,12 @@ int qla4xxx_set_chap(struct scsi_qla_host *ha, char *username, char *password,
        uint32_t chap_size = 0;
        dma_addr_t chap_dma;
 
-       chap_table = dma_pool_alloc(ha->chap_dma_pool, GFP_KERNEL, &chap_dma);
+       chap_table = dma_pool_zalloc(ha->chap_dma_pool, GFP_KERNEL, &chap_dma);
        if (chap_table == NULL) {
                ret =  -ENOMEM;
                goto exit_set_chap;
        }
 
-       memset(chap_table, 0, sizeof(struct ql4_chap_table));
        if (bidi)
                chap_table->flags |= BIT_6; /* peer */
        else
index 82e889bbe0ed8f1959de20fce2d4af88e493508e..589634358c83da1e7fc53aa50eb89b74b67d3387 100644 (file)
@@ -825,12 +825,10 @@ static int qla4xxx_delete_chap(struct Scsi_Host *shost, uint16_t chap_tbl_idx)
        uint32_t chap_size;
        int ret = 0;
 
-       chap_table = dma_pool_alloc(ha->chap_dma_pool, GFP_KERNEL, &chap_dma);
+       chap_table = dma_pool_zalloc(ha->chap_dma_pool, GFP_KERNEL, &chap_dma);
        if (chap_table == NULL)
                return -ENOMEM;
 
-       memset(chap_table, 0, sizeof(struct ql4_chap_table));
-
        if (is_qla80XX(ha))
                max_chap_entries = (ha->hw.flt_chap_size / 2) /
                                   sizeof(struct ql4_chap_table);