linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bjorn Helgaas <helgaas@kernel.org>
To: linux-pci@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, Bjorn Helgaas <bhelgaas@google.com>
Subject: [PATCH 08/12] PCI: Simplify pci_dev_driver()
Date: Thu, 24 Aug 2023 14:37:08 -0500	[thread overview]
Message-ID: <20230824193712.542167-9-helgaas@kernel.org> (raw)
In-Reply-To: <20230824193712.542167-1-helgaas@kernel.org>

From: Bjorn Helgaas <bhelgaas@google.com>

Simplify pci_dev_driver() by removing the "else".  The "if" case always
returns, so the "else" is superfluous.  No functional change intended.

Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
---
 drivers/pci/pci-driver.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
index a44ecf6bf5d2..a79c110c7e51 100644
--- a/drivers/pci/pci-driver.c
+++ b/drivers/pci/pci-driver.c
@@ -1474,14 +1474,15 @@ static struct pci_driver pci_compat_driver = {
  */
 struct pci_driver *pci_dev_driver(const struct pci_dev *dev)
 {
+	int i;
+
 	if (dev->driver)
 		return dev->driver;
-	else {
-		int i;
-		for (i = 0; i <= PCI_ROM_RESOURCE; i++)
-			if (dev->resource[i].flags & IORESOURCE_BUSY)
-				return &pci_compat_driver;
-	}
+
+	for (i = 0; i <= PCI_ROM_RESOURCE; i++)
+		if (dev->resource[i].flags & IORESOURCE_BUSY)
+			return &pci_compat_driver;
+
 	return NULL;
 }
 EXPORT_SYMBOL(pci_dev_driver);
-- 
2.34.1


  parent reply	other threads:[~2023-08-24 19:38 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-24 19:37 [PATCH 00/12] PCI: Miscellaneous cleanups Bjorn Helgaas
2023-08-24 19:37 ` [PATCH 01/12] PCI: mvebu: Remove unused struct mvebu_pcie.busn Bjorn Helgaas
2023-08-24 19:39   ` Pali Rohár
2023-08-24 20:21     ` Bjorn Helgaas
2023-08-24 19:37 ` [PATCH 02/12] PCI: Unexport pcie_port_bus_type Bjorn Helgaas
2023-08-24 19:37 ` [PATCH 03/12] PCI: Remove unnecessary initializations Bjorn Helgaas
2023-08-24 19:37 ` [PATCH 04/12] PCI: Fix printk field formatting Bjorn Helgaas
2023-08-24 19:37 ` [PATCH 05/12] PCI: Use consistent put_user() pointer types Bjorn Helgaas
2023-08-24 19:37 ` [PATCH 06/12] PCI/AER: Simplify AER_RECOVER_RING_SIZE definition Bjorn Helgaas
2023-08-24 19:37 ` [PATCH 07/12] PCI: Simplify pci_pio_to_address() Bjorn Helgaas
2023-08-24 19:37 ` Bjorn Helgaas [this message]
2023-08-24 19:37 ` [PATCH 09/12] PCI: Fix pci_bus_resetable(), pci_slot_resetable() name typos Bjorn Helgaas
2023-08-24 19:37 ` [PATCH 10/12] PCI: Fix typos in docs and comments Bjorn Helgaas
2023-08-24 21:20   ` Randy Dunlap
2023-08-24 19:37 ` [PATCH 11/12] PCI: Fix code formatting inconsistencies Bjorn Helgaas
2023-08-24 19:37 ` [PATCH 12/12] PCI: Simplify pcie_capability_clear_and_set_word() control flow Bjorn Helgaas
2023-08-25  8:09   ` Ilpo Järvinen
2023-08-25  9:01 ` [PATCH 00/12] PCI: Miscellaneous cleanups Ilpo Järvinen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230824193712.542167-9-helgaas@kernel.org \
    --to=helgaas@kernel.org \
    --cc=bhelgaas@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).