Commit dc785d69 authored by Irvin Cote's avatar Irvin Cote Committed by Christoph Hellwig

nvme-pci: always return an ERR_PTR from nvme_pci_alloc_dev

Don't mix NULL and ERR_PTR returns.

Fixes: 2e87570b ("nvme-pci: factor out a nvme_pci_alloc_dev helper")
Signed-off-by: default avatarIrvin Cote <irvin.cote@insa-lyon.fr>
Reviewed-by: default avatarKeith Busch <kbusch@kernel.org>
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
parent 924bd96e
...@@ -2964,7 +2964,7 @@ static struct nvme_dev *nvme_pci_alloc_dev(struct pci_dev *pdev, ...@@ -2964,7 +2964,7 @@ static struct nvme_dev *nvme_pci_alloc_dev(struct pci_dev *pdev,
dev = kzalloc_node(sizeof(*dev), GFP_KERNEL, node); dev = kzalloc_node(sizeof(*dev), GFP_KERNEL, node);
if (!dev) if (!dev)
return NULL; return ERR_PTR(-ENOMEM);
INIT_WORK(&dev->ctrl.reset_work, nvme_reset_work); INIT_WORK(&dev->ctrl.reset_work, nvme_reset_work);
mutex_init(&dev->shutdown_lock); mutex_init(&dev->shutdown_lock);
...@@ -3029,8 +3029,8 @@ static int nvme_probe(struct pci_dev *pdev, const struct pci_device_id *id) ...@@ -3029,8 +3029,8 @@ static int nvme_probe(struct pci_dev *pdev, const struct pci_device_id *id)
int result = -ENOMEM; int result = -ENOMEM;
dev = nvme_pci_alloc_dev(pdev, id); dev = nvme_pci_alloc_dev(pdev, id);
if (!dev) if (IS_ERR(dev))
return -ENOMEM; return PTR_ERR(dev);
result = nvme_dev_map(dev); result = nvme_dev_map(dev);
if (result) if (result)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment