PCI: Do error check on own line to split long "if" conditions
authorIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Mon, 11 Sep 2023 12:53:52 +0000 (15:53 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 28 Nov 2023 17:07:00 +0000 (17:07 +0000)
commitdabc0ee84d0d6e4a382ae6ee7893cb784f880dce
tree01bce6da8d8f782d8d6f13162441e7e5fbeb8753
parent146badf18e2ccfedc25f72f5365142c09f2189ee
PCI: Do error check on own line to split long "if" conditions

[ Upstream commit d15f18053e5cc5576af9e7eef0b2a91169b6326d ]

Placing PCI error code check inside "if" condition usually results in need
to split lines. Combined with additional conditions the "if" condition
becomes messy.

Convert to the usual error handling pattern with an additional variable to
improve code readability. In addition, reverse the logic in
pci_find_vsec_capability() to get rid of &&.

No functional changes intended.

Link: https://lore.kernel.org/r/20230911125354.25501-5-ilpo.jarvinen@linux.intel.com
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
[bhelgaas: PCI_POSSIBLE_ERROR()]
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/pci/pci.c
drivers/pci/probe.c
drivers/pci/quirks.c