Skip to content

Commit 54be5b8

Browse files
Wei Yongjundavem330
authored andcommitted
PCI: hv: Fix return value check in hv_pci_assign_slots()
In case of error, the function pci_create_slot() returns ERR_PTR() and never returns NULL. The NULL test in the return value check should be replaced with IS_ERR(). Fixes: a15f2c0 ("PCI: hv: support reporting serial number as slot information") Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 86f9bd1 commit 54be5b8

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/pci/controller/pci-hyperv.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1484,8 +1484,10 @@ static void hv_pci_assign_slots(struct hv_pcibus_device *hbus)
14841484
snprintf(name, SLOT_NAME_SIZE, "%u", hpdev->desc.ser);
14851485
hpdev->pci_slot = pci_create_slot(hbus->pci_bus, slot_nr,
14861486
name, NULL);
1487-
if (!hpdev->pci_slot)
1487+
if (IS_ERR(hpdev->pci_slot)) {
14881488
pr_warn("pci_create slot %s failed\n", name);
1489+
hpdev->pci_slot = NULL;
1490+
}
14891491
}
14901492
}
14911493

0 commit comments

Comments
 (0)