Skip to contentSkip to conversation

scsi: qla4xxx: Use dma_pool_zalloc

PATCH Superseded Souptick Joarder 2 participants 6 messages Dec 6, 2016 – Dec 21, 2016

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scsi: qla4xxx: Use dma_pool_zalloc

We should use dma_pool_zalloc instead of dma_pool_alloc/memset

---
 drivers/scsi/qla4xxx/ql4_mbx.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/scsi/qla4xxx/ql4_mbx.c +1 -2
index c291fdf..f2edfd7 100644
@@ -1587,12 +1587,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);

--
1.9.1

#1 lore raw
Quoted 26 lines · Souptick Joarder

We should use dma_pool_zalloc instead of dma_pool_alloc/memset

---
 drivers/scsi/qla4xxx/ql4_mbx.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/scsi/qla4xxx/ql4_mbx.c +1 -3
index c291fdf..f2edfd7 100644
@@ -1587,12 +1587,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);
--
Quoted 2 lines

1.9.1

Any comment on this patch?

#2 lore raw
Quoted 29 lines · On 12/12/16, 10:16 AM, "[email protected] on behalf of Souptick…
Quoted 27 lines · Souptick Joarder

We should use dma_pool_zalloc instead of dma_pool_alloc/memset

---
 drivers/scsi/qla4xxx/ql4_mbx.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/scsi/qla4xxx/ql4_mbx.c +1 -2
index c291fdf..f2edfd7 100644
@@ -1587,12 +1587,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);
Quoted 7 lines
Quoted 5 lines
        if (is_qla40XX(ha))
                offset = FLASH_CHAP_OFFSET | (idx * chap_size);

--
1.9.1

Any comment on this patch?

There are multiple other places where dma_pool_alloc needs to be replaced by dma_pool_zalloc.

Can you please take care within a single patch.

Thanks,
Nilesh

#3 lore raw
Quoted 43 lines · Nilesh
Quoted 29 lines · On 12/12/16, 10:16 AM, "[email protected] on behalf of Souptick…
Quoted 27 lines · Souptick Joarder

We should use dma_pool_zalloc instead of dma_pool_alloc/memset

---
 drivers/scsi/qla4xxx/ql4_mbx.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/scsi/qla4xxx/ql4_mbx.c +1 -2
index c291fdf..f2edfd7 100644
@@ -1587,12 +1587,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);
Quoted 7 lines
Quoted 5 lines
        if (is_qla40XX(ha))
                offset = FLASH_CHAP_OFFSET | (idx * chap_size);

--
1.9.1

Any comment on this patch?

Quoted 2 lines

There are multiple other places where dma_pool_alloc needs to be replaced by dma_pool_zalloc.

are you asking to do this for SCSI subsystem?
If yes, I can do that.

Quoted 2 lines

Can you please take care within a single patch.

But the same changes are applicable in other subsystems as well. I think I shouldn't send those changes in a single patch as
maintainers are different
for different modules.

Quoted 4 lines

Thanks,
Nilesh

#4 lore raw
Quoted 54 lines · Souptick Joarder
Quoted 43 lines · Nilesh
Quoted 29 lines · On 12/12/16, 10:16 AM, "[email protected] on behalf of Souptick…
Quoted 27 lines · Souptick Joarder

We should use dma_pool_zalloc instead of dma_pool_alloc/memset

---
 drivers/scsi/qla4xxx/ql4_mbx.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/scsi/qla4xxx/ql4_mbx.c +1 -2
index c291fdf..f2edfd7 100644
@@ -1587,12 +1587,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);
Quoted 7 lines
Quoted 5 lines
        if (is_qla40XX(ha))
                offset = FLASH_CHAP_OFFSET | (idx * chap_size);

--
1.9.1

Any comment on this patch?

Quoted 3 lines

There are multiple other places where dma_pool_alloc needs to be replaced
by dma_pool_zalloc.

are you asking to do this for SCSI subsystem?
If yes, I can do that.

Quoted 1 line
Quoted 6 lines
Quoted 1 line

Can you please take care within a single patch.

But the same changes are applicable in other subsystems as well. I think I shouldn't send those changes in a single patch as maintainers are different
for different modules.

I'm referring to multiple other files within qla4xxx source which uses dma_pool_alloc.
The current patch takes care only of ql4_mbx.c and qla4xxx_get_chap function.
There is qla4xxx_set_chap function as well. Also ql4_init.c and ql4_os.c files also use dma_pool_alloc.
I was requesting to make all these changes related to qla4xxx module within a single patch.

Thanks,
Nilesh

#5 lore raw
Quoted 65 lines · Nilesh
Quoted 54 lines · Souptick Joarder
Quoted 43 lines · Nilesh
Quoted 29 lines · On 12/12/16, 10:16 AM, "[email protected] on behalf of Souptick…
Quoted 27 lines · Souptick Joarder

We should use dma_pool_zalloc instead of dma_pool_alloc/memset

---
 drivers/scsi/qla4xxx/ql4_mbx.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/scsi/qla4xxx/ql4_mbx.c +1 -2
index c291fdf..f2edfd7 100644
@@ -1587,12 +1587,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);
Quoted 7 lines
Quoted 5 lines
        if (is_qla40XX(ha))
                offset = FLASH_CHAP_OFFSET | (idx * chap_size);

--
1.9.1

Any comment on this patch?

Quoted 3 lines

There are multiple other places where dma_pool_alloc needs to be replaced
by dma_pool_zalloc.

are you asking to do this for SCSI subsystem?
If yes, I can do that.

Quoted 1 line
Quoted 6 lines
Quoted 1 line

Can you please take care within a single patch.

But the same changes are applicable in other subsystems as well. I think I shouldn't send those changes in a single patch as maintainers are different
for different modules.

Quoted 8 lines

I'm referring to multiple other files within qla4xxx source which uses dma_pool_alloc.
The current patch takes care only of ql4_mbx.c and qla4xxx_get_chap function.
There is qla4xxx_set_chap function as well. Also ql4_init.c and ql4_os.c files also use dma_pool_alloc.
I was requesting to make all these changes related to qla4xxx module within a single patch.

Well I will do that.

Quoted 4 lines

Thanks,
Nilesh