Skip to content

Commit dc785d6

Browse files
Irvin CoteChristoph Hellwig
authored andcommitted
nvme-pci: always return an ERR_PTR from nvme_pci_alloc_dev
Don't mix NULL and ERR_PTR returns. Fixes: 2e87570 ("nvme-pci: factor out a nvme_pci_alloc_dev helper") Signed-off-by: Irvin Cote <[email protected]> Reviewed-by: Keith Busch <[email protected]> Signed-off-by: Christoph Hellwig <[email protected]>
1 parent 924bd96 commit dc785d6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/nvme/host/pci.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2964,7 +2964,7 @@ static struct nvme_dev *nvme_pci_alloc_dev(struct pci_dev *pdev,
29642964

29652965
dev = kzalloc_node(sizeof(*dev), GFP_KERNEL, node);
29662966
if (!dev)
2967-
return NULL;
2967+
return ERR_PTR(-ENOMEM);
29682968
INIT_WORK(&dev->ctrl.reset_work, nvme_reset_work);
29692969
mutex_init(&dev->shutdown_lock);
29702970

@@ -3029,8 +3029,8 @@ static int nvme_probe(struct pci_dev *pdev, const struct pci_device_id *id)
30293029
int result = -ENOMEM;
30303030

30313031
dev = nvme_pci_alloc_dev(pdev, id);
3032-
if (!dev)
3033-
return -ENOMEM;
3032+
if (IS_ERR(dev))
3033+
return PTR_ERR(dev);
30343034

30353035
result = nvme_dev_map(dev);
30363036
if (result)

0 commit comments

Comments
 (0)