* [PATCH 1/4] nvme-fabrics: remove memset in nvmf_reg_read64()
2021-06-15 2:45 [PATCH 0/4] nvme-fabrics: remove struct zeroout memset calls Chaitanya Kulkarni
@ 2021-06-15 2:45 ` Chaitanya Kulkarni
2021-06-15 2:45 ` [PATCH 2/4] nvme-fabrics: remove memset in nvmf_reg_write32() Chaitanya Kulkarni
` (4 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: Chaitanya Kulkarni @ 2021-06-15 2:45 UTC (permalink / raw)
To: linux-nvme; +Cc: hch, sagi, Chaitanya Kulkarni
Declare and initialize structure variable to the zero values so that we
can get rid of the zeroout memset call.
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
---
drivers/nvme/host/fabrics.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/nvme/host/fabrics.c b/drivers/nvme/host/fabrics.c
index 690e749eee83..506bb976251b 100644
--- a/drivers/nvme/host/fabrics.c
+++ b/drivers/nvme/host/fabrics.c
@@ -186,11 +186,10 @@ EXPORT_SYMBOL_GPL(nvmf_reg_read32);
*/
int nvmf_reg_read64(struct nvme_ctrl *ctrl, u32 off, u64 *val)
{
- struct nvme_command cmd;
+ struct nvme_command cmd = { };
union nvme_result res;
int ret;
- memset(&cmd, 0, sizeof(cmd));
cmd.prop_get.opcode = nvme_fabrics_command;
cmd.prop_get.fctype = nvme_fabrics_type_property_get;
cmd.prop_get.attrib = 1;
--
2.22.1
_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/4] nvme-fabrics: remove memset in nvmf_reg_write32()
2021-06-15 2:45 [PATCH 0/4] nvme-fabrics: remove struct zeroout memset calls Chaitanya Kulkarni
2021-06-15 2:45 ` [PATCH 1/4] nvme-fabrics: remove memset in nvmf_reg_read64() Chaitanya Kulkarni
@ 2021-06-15 2:45 ` Chaitanya Kulkarni
2021-06-15 2:45 ` [PATCH 3/4] nvme-fabrics: remove memset in connect admin q Chaitanya Kulkarni
` (3 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: Chaitanya Kulkarni @ 2021-06-15 2:45 UTC (permalink / raw)
To: linux-nvme; +Cc: hch, sagi, Chaitanya Kulkarni
Declare and initialize structure variable to the zero values so that we
can get rid of the zeroout memset call.
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
---
drivers/nvme/host/fabrics.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/nvme/host/fabrics.c b/drivers/nvme/host/fabrics.c
index 506bb976251b..ccec9acedef5 100644
--- a/drivers/nvme/host/fabrics.c
+++ b/drivers/nvme/host/fabrics.c
@@ -231,10 +231,9 @@ EXPORT_SYMBOL_GPL(nvmf_reg_read64);
*/
int nvmf_reg_write32(struct nvme_ctrl *ctrl, u32 off, u32 val)
{
- struct nvme_command cmd;
+ struct nvme_command cmd = { };
int ret;
- memset(&cmd, 0, sizeof(cmd));
cmd.prop_set.opcode = nvme_fabrics_command;
cmd.prop_set.fctype = nvme_fabrics_type_property_set;
cmd.prop_set.attrib = 0;
--
2.22.1
_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 3/4] nvme-fabrics: remove memset in connect admin q
2021-06-15 2:45 [PATCH 0/4] nvme-fabrics: remove struct zeroout memset calls Chaitanya Kulkarni
2021-06-15 2:45 ` [PATCH 1/4] nvme-fabrics: remove memset in nvmf_reg_read64() Chaitanya Kulkarni
2021-06-15 2:45 ` [PATCH 2/4] nvme-fabrics: remove memset in nvmf_reg_write32() Chaitanya Kulkarni
@ 2021-06-15 2:45 ` Chaitanya Kulkarni
2021-06-15 2:45 ` [PATCH 4/4] nvme-fabrics: remove memset in connect io q Chaitanya Kulkarni
` (2 subsequent siblings)
5 siblings, 0 replies; 8+ messages in thread
From: Chaitanya Kulkarni @ 2021-06-15 2:45 UTC (permalink / raw)
To: linux-nvme; +Cc: hch, sagi, Chaitanya Kulkarni
Declare and initialize structure variable to the zero values so that we
can get rid of the zeroout memset call.
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
---
drivers/nvme/host/fabrics.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/nvme/host/fabrics.c b/drivers/nvme/host/fabrics.c
index ccec9acedef5..86a1a05de71b 100644
--- a/drivers/nvme/host/fabrics.c
+++ b/drivers/nvme/host/fabrics.c
@@ -354,12 +354,11 @@ static void nvmf_log_connect_error(struct nvme_ctrl *ctrl,
*/
int nvmf_connect_admin_queue(struct nvme_ctrl *ctrl)
{
- struct nvme_command cmd;
+ struct nvme_command cmd = { };
union nvme_result res;
struct nvmf_connect_data *data;
int ret;
- memset(&cmd, 0, sizeof(cmd));
cmd.connect.opcode = nvme_fabrics_command;
cmd.connect.fctype = nvme_fabrics_type_connect;
cmd.connect.qid = 0;
--
2.22.1
_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 4/4] nvme-fabrics: remove memset in connect io q
2021-06-15 2:45 [PATCH 0/4] nvme-fabrics: remove struct zeroout memset calls Chaitanya Kulkarni
` (2 preceding siblings ...)
2021-06-15 2:45 ` [PATCH 3/4] nvme-fabrics: remove memset in connect admin q Chaitanya Kulkarni
@ 2021-06-15 2:45 ` Chaitanya Kulkarni
2021-06-15 16:19 ` [PATCH 0/4] nvme-fabrics: remove struct zeroout memset calls Christoph Hellwig
2021-06-15 18:42 ` Keith Busch
5 siblings, 0 replies; 8+ messages in thread
From: Chaitanya Kulkarni @ 2021-06-15 2:45 UTC (permalink / raw)
To: linux-nvme; +Cc: hch, sagi, Chaitanya Kulkarni
Declare and initialize structure variable to the zero values so that we
can get rid of the zeroout memset call.
Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
---
drivers/nvme/host/fabrics.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/nvme/host/fabrics.c b/drivers/nvme/host/fabrics.c
index 86a1a05de71b..b13b42bf2074 100644
--- a/drivers/nvme/host/fabrics.c
+++ b/drivers/nvme/host/fabrics.c
@@ -421,12 +421,11 @@ EXPORT_SYMBOL_GPL(nvmf_connect_admin_queue);
*/
int nvmf_connect_io_queue(struct nvme_ctrl *ctrl, u16 qid, bool poll)
{
- struct nvme_command cmd;
+ struct nvme_command cmd = { };
struct nvmf_connect_data *data;
union nvme_result res;
int ret;
- memset(&cmd, 0, sizeof(cmd));
cmd.connect.opcode = nvme_fabrics_command;
cmd.connect.fctype = nvme_fabrics_type_connect;
cmd.connect.qid = cpu_to_le16(qid);
--
2.22.1
_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 0/4] nvme-fabrics: remove struct zeroout memset calls
2021-06-15 2:45 [PATCH 0/4] nvme-fabrics: remove struct zeroout memset calls Chaitanya Kulkarni
` (3 preceding siblings ...)
2021-06-15 2:45 ` [PATCH 4/4] nvme-fabrics: remove memset in connect io q Chaitanya Kulkarni
@ 2021-06-15 16:19 ` Christoph Hellwig
2021-06-15 18:42 ` Keith Busch
5 siblings, 0 replies; 8+ messages in thread
From: Christoph Hellwig @ 2021-06-15 16:19 UTC (permalink / raw)
To: Chaitanya Kulkarni; +Cc: linux-nvme, hch, sagi
Thanks,
applied to nvme-5.14.
_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 0/4] nvme-fabrics: remove struct zeroout memset calls
2021-06-15 2:45 [PATCH 0/4] nvme-fabrics: remove struct zeroout memset calls Chaitanya Kulkarni
` (4 preceding siblings ...)
2021-06-15 16:19 ` [PATCH 0/4] nvme-fabrics: remove struct zeroout memset calls Christoph Hellwig
@ 2021-06-15 18:42 ` Keith Busch
2021-06-15 20:07 ` Chaitanya Kulkarni
5 siblings, 1 reply; 8+ messages in thread
From: Keith Busch @ 2021-06-15 18:42 UTC (permalink / raw)
To: Chaitanya Kulkarni; +Cc: linux-nvme, hch, sagi
On Mon, Jun 14, 2021 at 07:45:50PM -0700, Chaitanya Kulkarni wrote:
> Hi,
>
> While reviewing the code I did removed the calls to zero out structures
> using memset() for the lio target, which are reviewed and accepted in
> the linux kernel tree. (see [1])
>
> This patch series is based on the same cleanup pattern for NVMe host.
> This will allow us to have uniform pattern in the future code review to
> avoid similar calls which seems unnecessary.
>
> If this is accepted I'll gradually convert the rest of the host code
> mainly core and pci.
This looks good, and aligns with the local style. For future cleanups, I
think it would be fine to do it a single patch instead of individual
patches per function.
Reviewed-by: Keith Busch <kbusch@kernel.org>
_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 0/4] nvme-fabrics: remove struct zeroout memset calls
2021-06-15 18:42 ` Keith Busch
@ 2021-06-15 20:07 ` Chaitanya Kulkarni
0 siblings, 0 replies; 8+ messages in thread
From: Chaitanya Kulkarni @ 2021-06-15 20:07 UTC (permalink / raw)
To: Keith Busch; +Cc: linux-nvme, hch, sagi
On 6/15/21 11:42, Keith Busch wrote:
>> If this is accepted I'll gradually convert the rest of the host code
>> mainly core and pci.
> This looks good, and aligns with the local style. For future cleanups, I
> think it would be fine to do it a single patch instead of individual
> patches per function.
>
> Reviewed-by: Keith Busch <kbusch@kernel.org>
>
Sound good will send soon.
_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
^ permalink raw reply [flat|nested] 8+ messages in thread