Skip to content

Commit 1452cd7

Browse files
committed
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: Bjorn Helgaas <bhelgaas@google.com>
1 parent 6b13672 commit 1452cd7

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

‎drivers/pci/iov.c‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -729,10 +729,10 @@ EXPORT_SYMBOL_GPL(pci_sriov_migration);
729729
*/
730730
int pci_num_vf(struct pci_dev *dev)
731731
{
732-
if (!dev || !dev->is_physfn)
732+
if (!dev->is_physfn)
733733
return 0;
734-
else
735-
return dev->sriov->num_VFs;
734+
735+
return dev->sriov->num_VFs;
736736
}
737737
EXPORT_SYMBOL_GPL(pci_num_vf);
738738

@@ -750,7 +750,7 @@ EXPORT_SYMBOL_GPL(pci_num_vf);
750750
*/
751751
int pci_sriov_set_totalvfs(struct pci_dev *dev, u16 numvfs)
752752
{
753-
if (!dev || !dev->is_physfn || (numvfs > dev->sriov->total_VFs))
753+
if (!dev->is_physfn || (numvfs > dev->sriov->total_VFs))
754754
return -EINVAL;
755755

756756
/* Shouldn't change if VFs already enabled */
@@ -773,12 +773,12 @@ EXPORT_SYMBOL_GPL(pci_sriov_set_totalvfs);
773773
*/
774774
int pci_sriov_get_totalvfs(struct pci_dev *dev)
775775
{
776-
if (!dev || !dev->is_physfn)
776+
if (!dev->is_physfn)
777777
return -EINVAL;
778778

779779
if (dev->sriov->driver_max_VFs)
780780
return dev->sriov->driver_max_VFs;
781-
else
782-
return dev->sriov->total_VFs;
781+
782+
return dev->sriov->total_VFs;
783783
}
784784
EXPORT_SYMBOL_GPL(pci_sriov_get_totalvfs);

0 commit comments

Comments
 (0)