mirror of
https://github.com/torvalds/linux.git
synced 2024-11-26 06:02:05 +00:00
PCI: Simplify pcie_capability_clear_and_set_word() control flow
Return early for errors in pcie_capability_clear_and_set_word_unlocked() and pcie_capability_clear_and_set_dword() to simplify the control flow. No functional change intended. Link: https://lore.kernel.org/r/20230824193712.542167-13-helgaas@kernel.org Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
This commit is contained in:
parent
da54556695
commit
294c1e4fa7
@ -504,13 +504,12 @@ int pcie_capability_clear_and_set_word_unlocked(struct pci_dev *dev, int pos,
|
||||
u16 val;
|
||||
|
||||
ret = pcie_capability_read_word(dev, pos, &val);
|
||||
if (!ret) {
|
||||
val &= ~clear;
|
||||
val |= set;
|
||||
ret = pcie_capability_write_word(dev, pos, val);
|
||||
}
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
return ret;
|
||||
val &= ~clear;
|
||||
val |= set;
|
||||
return pcie_capability_write_word(dev, pos, val);
|
||||
}
|
||||
EXPORT_SYMBOL(pcie_capability_clear_and_set_word_unlocked);
|
||||
|
||||
@ -535,13 +534,12 @@ int pcie_capability_clear_and_set_dword(struct pci_dev *dev, int pos,
|
||||
u32 val;
|
||||
|
||||
ret = pcie_capability_read_dword(dev, pos, &val);
|
||||
if (!ret) {
|
||||
val &= ~clear;
|
||||
val |= set;
|
||||
ret = pcie_capability_write_dword(dev, pos, val);
|
||||
}
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
return ret;
|
||||
val &= ~clear;
|
||||
val |= set;
|
||||
return pcie_capability_write_dword(dev, pos, val);
|
||||
}
|
||||
EXPORT_SYMBOL(pcie_capability_clear_and_set_dword);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user