Skip to contentSkip to conversation

nvme-pci: remove an unnecessary initialization in HMB code

PATCH New Minwoo Im 2 participants 4 messages Dec 4, 2017 NVMe

lore
Share & tools
lore

Minwoo Im

author
#0 lore raw

PATCH 1/1 nvme-pci: remove an unnecessary initialization in HMB code

The local variable __size__ will be set a bit later in a for-loop. Remove the explicit initialization at the beginning of this function.

Signed-off-by Minwoo Im <minwoo.im.dev at gmail.com>
---
 drivers/nvme/host/pci.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/nvme/host/pci.c +2 -2
index f5800c3..35331fa 100644
@@ -1770,7 +1770,7 @@ static int __nvme_alloc_host_mem(struct nvme_dev *dev, u64 preferred,
 	dma_addr_t descs_dma;
 	int i = 0;
 	void **bufs;
-	u64 size = 0, tmp;
+	u64 size, tmp;
 
 	tmp = (preferred + chunk_size - 1);
 	do_div(tmp, chunk_size);
@@ -1853,7 +1853,7 @@ static int nvme_setup_host_mem(struct nvme_dev *dev)
 	u64 preferred = (u64)dev->ctrl.hmpre * 4096;
 	u64 min = (u64)dev->ctrl.hmmin * 4096;
 	u32 enable_bits = NVME_HOST_MEM_ENABLE;
-	int ret = 0;
+	int ret;
 
 	preferred = min(preferred, max);
 	if (min > max) {
Signature · 1 line
2.7.4
maintainer Applied
#1 lore raw

PATCH 1/1 nvme-pci: remove an unnecessary initialization in HMB code

Quoted 2 lines · Minwoo Im

The local variable __size__ will be set a bit later in a for-loop. Remove the explicit initialization at the beginning of this function.

Thanks,

applied to nvme-4.16.

author
#2 lore raw

PATCH 1/1 nvme-pci: remove an unnecessary initialization in HMB code

In reply to Minwoo Im
Quoted 31 lines · Minwoo Im

The local variable __size__ will be set a bit later in a for-loop. Remove the explicit initialization at the beginning of this function.

Signed-off-by Minwoo Im <minwoo.im.dev at gmail.com>
---
 drivers/nvme/host/pci.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/nvme/host/pci.c +2 -3
index f5800c3..35331fa 100644
@@ -1770,7 +1770,7 @@ static int __nvme_alloc_host_mem(struct nvme_dev *dev, u64 preferred,
        dma_addr_t descs_dma;
        int i = 0;
        void **bufs;
-       u64 size = 0, tmp;
+       u64 size, tmp;
 
        tmp = (preferred + chunk_size - 1);
        do_div(tmp, chunk_size);
@@ -1853,7 +1853,7 @@ static int nvme_setup_host_mem(struct nvme_dev *dev)
        u64 preferred = (u64)dev->ctrl.hmpre * 4096;
        u64 min = (u64)dev->ctrl.hmmin * 4096;
        u32 enable_bits = NVME_HOST_MEM_ENABLE;
-       int ret = 0;
+       int ret;
 
        preferred = min(preferred, max);
        if (min > max) {
--
Quoted 2 lines

2.7.4

Please ignore this mail. Sorry for making confusions.

Thanks,

author
#3 lore raw

PATCH 1/1 nvme-pci: remove an unnecessary initialization in HMB code

Quoted 38 lines · Minwoo Im
Quoted 31 lines · Minwoo Im

The local variable __size__ will be set a bit later in a for-loop. Remove the explicit initialization at the beginning of this function.

Signed-off-by Minwoo Im <minwoo.im.dev at gmail.com>
---
 drivers/nvme/host/pci.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/nvme/host/pci.c +2 -3
index f5800c3..35331fa 100644
@@ -1770,7 +1770,7 @@ static int __nvme_alloc_host_mem(struct nvme_dev *dev, u64 preferred,
        dma_addr_t descs_dma;
        int i = 0;
        void **bufs;
-       u64 size = 0, tmp;
+       u64 size, tmp;
 
        tmp = (preferred + chunk_size - 1);
        do_div(tmp, chunk_size);
@@ -1853,7 +1853,7 @@ static int nvme_setup_host_mem(struct nvme_dev *dev)
        u64 preferred = (u64)dev->ctrl.hmpre * 4096;
        u64 min = (u64)dev->ctrl.hmmin * 4096;
        u32 enable_bits = NVME_HOST_MEM_ENABLE;
-       int ret = 0;
+       int ret;
 
        preferred = min(preferred, max);
        if (min > max) {
--
Quoted 2 lines

2.7.4

Please ignore this mail. Sorry for making confusions.

Quoted 1 line

Thanks,

Hi Christoph,

I think you have alraedy picked it up.
I'll not make any improper patch(format, description, etc) from now on.

Thanks to you for picking it up.