Commit 0a1a9b49 authored by Wei Yang's avatar Wei Yang Committed by Bjorn Helgaas

PCI: Simplify pci_find_(ext_)capability() return value checks

The return value of the pci_find_(ext_)capability() is either zero or the
position of a capability.  It is never negative.

This patch consolidates the form of check from (pos <= 0) to (!pos).
Signed-off-by: default avatarWei Yang <weiyang@linux.vnet.ibm.com>
Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
parent fff905f3
...@@ -971,7 +971,7 @@ static int pci_save_pcix_state(struct pci_dev *dev) ...@@ -971,7 +971,7 @@ static int pci_save_pcix_state(struct pci_dev *dev)
struct pci_cap_saved_state *save_state; struct pci_cap_saved_state *save_state;
pos = pci_find_capability(dev, PCI_CAP_ID_PCIX); pos = pci_find_capability(dev, PCI_CAP_ID_PCIX);
if (pos <= 0) if (!pos)
return 0; return 0;
save_state = pci_find_saved_cap(dev, PCI_CAP_ID_PCIX); save_state = pci_find_saved_cap(dev, PCI_CAP_ID_PCIX);
...@@ -994,7 +994,7 @@ static void pci_restore_pcix_state(struct pci_dev *dev) ...@@ -994,7 +994,7 @@ static void pci_restore_pcix_state(struct pci_dev *dev)
save_state = pci_find_saved_cap(dev, PCI_CAP_ID_PCIX); save_state = pci_find_saved_cap(dev, PCI_CAP_ID_PCIX);
pos = pci_find_capability(dev, PCI_CAP_ID_PCIX); pos = pci_find_capability(dev, PCI_CAP_ID_PCIX);
if (!save_state || pos <= 0) if (!save_state || !pos)
return; return;
cap = (u16 *)&save_state->cap.data[0]; cap = (u16 *)&save_state->cap.data[0];
...@@ -2158,7 +2158,7 @@ static int _pci_add_cap_save_buffer(struct pci_dev *dev, u16 cap, ...@@ -2158,7 +2158,7 @@ static int _pci_add_cap_save_buffer(struct pci_dev *dev, u16 cap,
else else
pos = pci_find_capability(dev, cap); pos = pci_find_capability(dev, cap);
if (pos <= 0) if (!pos)
return 0; return 0;
save_state = kzalloc(sizeof(*save_state) + size, GFP_KERNEL); save_state = kzalloc(sizeof(*save_state) + size, GFP_KERNEL);
......
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