diff options
author | Wei Yongjun <weiyongjun1@huawei.com> | 2018-09-21 04:53:17 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-09-22 04:13:22 +0200 |
commit | 54be5b8ce33f8d1a05b258070c81ed98f935883d (patch) | |
tree | ce0ecc3379ae8c477897f76a61111aae4c6a5a26 /drivers/pci | |
parent | net/ipv6: Display all addresses in output of /proc/net/if_inet6 (diff) | |
download | linux-54be5b8ce33f8d1a05b258070c81ed98f935883d.tar.xz linux-54be5b8ce33f8d1a05b258070c81ed98f935883d.zip |
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: a15f2c08c708 ("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>
Diffstat (limited to 'drivers/pci')
-rw-r--r-- | drivers/pci/controller/pci-hyperv.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/pci/controller/pci-hyperv.c b/drivers/pci/controller/pci-hyperv.c index ee80e79db21a..9ba4d12c179c 100644 --- a/drivers/pci/controller/pci-hyperv.c +++ b/drivers/pci/controller/pci-hyperv.c @@ -1484,8 +1484,10 @@ static void hv_pci_assign_slots(struct hv_pcibus_device *hbus) snprintf(name, SLOT_NAME_SIZE, "%u", hpdev->desc.ser); hpdev->pci_slot = pci_create_slot(hbus->pci_bus, slot_nr, name, NULL); - if (!hpdev->pci_slot) + if (IS_ERR(hpdev->pci_slot)) { pr_warn("pci_create slot %s failed\n", name); + hpdev->pci_slot = NULL; + } } } |