Commit 1452cd76 authored by Bjorn Helgaas's avatar Bjorn Helgaas

PCI: Remove useless "!dev" tests

No need to check "!dev" when the caller should always supply a valid
pointer.  If the caller *doesn't* supply a valid pointer, it probably
won't check for a failure return either.  This way we'll oops and get a
backtrace.
Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
parent 6b136724
...@@ -729,9 +729,9 @@ EXPORT_SYMBOL_GPL(pci_sriov_migration); ...@@ -729,9 +729,9 @@ EXPORT_SYMBOL_GPL(pci_sriov_migration);
*/ */
int pci_num_vf(struct pci_dev *dev) int pci_num_vf(struct pci_dev *dev)
{ {
if (!dev || !dev->is_physfn) if (!dev->is_physfn)
return 0; return 0;
else
return dev->sriov->num_VFs; return dev->sriov->num_VFs;
} }
EXPORT_SYMBOL_GPL(pci_num_vf); EXPORT_SYMBOL_GPL(pci_num_vf);
...@@ -750,7 +750,7 @@ EXPORT_SYMBOL_GPL(pci_num_vf); ...@@ -750,7 +750,7 @@ EXPORT_SYMBOL_GPL(pci_num_vf);
*/ */
int pci_sriov_set_totalvfs(struct pci_dev *dev, u16 numvfs) int pci_sriov_set_totalvfs(struct pci_dev *dev, u16 numvfs)
{ {
if (!dev || !dev->is_physfn || (numvfs > dev->sriov->total_VFs)) if (!dev->is_physfn || (numvfs > dev->sriov->total_VFs))
return -EINVAL; return -EINVAL;
/* Shouldn't change if VFs already enabled */ /* Shouldn't change if VFs already enabled */
...@@ -773,12 +773,12 @@ EXPORT_SYMBOL_GPL(pci_sriov_set_totalvfs); ...@@ -773,12 +773,12 @@ EXPORT_SYMBOL_GPL(pci_sriov_set_totalvfs);
*/ */
int pci_sriov_get_totalvfs(struct pci_dev *dev) int pci_sriov_get_totalvfs(struct pci_dev *dev)
{ {
if (!dev || !dev->is_physfn) if (!dev->is_physfn)
return -EINVAL; return -EINVAL;
if (dev->sriov->driver_max_VFs) if (dev->sriov->driver_max_VFs)
return dev->sriov->driver_max_VFs; return dev->sriov->driver_max_VFs;
else
return dev->sriov->total_VFs; return dev->sriov->total_VFs;
} }
EXPORT_SYMBOL_GPL(pci_sriov_get_totalvfs); EXPORT_SYMBOL_GPL(pci_sriov_get_totalvfs);
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