Skip to content

Commit acb71e5

Browse files
author
Christoph Hellwig
committed
nvme-pci: move the HMPRE check into nvme_setup_host_mem
Check that a HMB is wanted into the allocation helper instead of the caller. This makes life simpler for an upcoming second caller. Signed-off-by: Christoph Hellwig <[email protected]> Reviewed-by: Sagi Grimberg <[email protected]> Reviewed-by: Chaitanya Kulkarni <[email protected]>
1 parent 65a5464 commit acb71e5

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

drivers/nvme/host/pci.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2102,6 +2102,9 @@ static int nvme_setup_host_mem(struct nvme_dev *dev)
21022102
u32 enable_bits = NVME_HOST_MEM_ENABLE;
21032103
int ret;
21042104

2105+
if (!dev->ctrl.hmpre)
2106+
return 0;
2107+
21052108
preferred = min(preferred, max);
21062109
if (min > max) {
21072110
dev_warn(dev->ctrl.device,
@@ -2862,11 +2865,9 @@ static void nvme_reset_work(struct work_struct *work)
28622865

28632866
nvme_dbbuf_dma_alloc(dev);
28642867

2865-
if (dev->ctrl.hmpre) {
2866-
result = nvme_setup_host_mem(dev);
2867-
if (result < 0)
2868-
goto out;
2869-
}
2868+
result = nvme_setup_host_mem(dev);
2869+
if (result < 0)
2870+
goto out;
28702871

28712872
result = nvme_setup_io_queues(dev);
28722873
if (result)

0 commit comments

Comments
 (0)