From: Christoph Hellwig Date: Sun, 13 Nov 2022 11:05:58 +0000 (+0100) Subject: nvme-pci: move the HMPRE check into nvme_setup_host_mem X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=acb71e53bb47a08731aa77497cd3f1871cba59c3;p=linux.git 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 Reviewed-by: Sagi Grimberg Reviewed-by: Chaitanya Kulkarni --- diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c index 4da339690ec67..57fb88396fd8c 100644 --- a/drivers/nvme/host/pci.c +++ b/drivers/nvme/host/pci.c @@ -2102,6 +2102,9 @@ static int nvme_setup_host_mem(struct nvme_dev *dev) u32 enable_bits = NVME_HOST_MEM_ENABLE; int ret; + if (!dev->ctrl.hmpre) + return 0; + preferred = min(preferred, max); if (min > max) { dev_warn(dev->ctrl.device, @@ -2862,11 +2865,9 @@ static void nvme_reset_work(struct work_struct *work) nvme_dbbuf_dma_alloc(dev); - if (dev->ctrl.hmpre) { - result = nvme_setup_host_mem(dev); - if (result < 0) - goto out; - } + result = nvme_setup_host_mem(dev); + if (result < 0) + goto out; result = nvme_setup_io_queues(dev); if (result)