DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Riley Fletcher <rileyf@linux.ibm.com>
To: dev@dpdk.org
Cc: stable@dpdk.org, patrickrobb1997@gmail.com,
	Luca.Vizzarro@arm.com, Riley Fletcher <rileyf@linux.ibm.com>
Subject: [PATCH v2] dts: fix port info getter when port is not found
Date: Wed, 22 Apr 2026 13:35:24 -0500	[thread overview]
Message-ID: <20260422183524.2012369-1-rileyf@linux.ibm.com> (raw)

In DTS, when providing an nonexisting PCI address, a ConfigurationError
should be thrown. Instead, because the next() is not given a default
None, it instead hits a StopIteration error, which is harder to debug.

Fixes: 0a210d88c36 ("dts: improve port model")
Cc: stable@dpdk.org
Signed-off-by: Riley Fletcher <rileyf@linux.ibm.com>
---
 dts/framework/testbed_model/linux_session.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dts/framework/testbed_model/linux_session.py b/dts/framework/testbed_model/linux_session.py
index ee943462c2..3de92b549e 100644
--- a/dts/framework/testbed_model/linux_session.py
+++ b/dts/framework/testbed_model/linux_session.py
@@ -168,7 +168,7 @@ def get_port_info(self, pci_address: str) -> PortInfo:
             ConfigurationError: If the port could not be found.
         """
         bus_info = f"pci@{pci_address}"
-        port = next(port for port in self._lshw_net_info if port.get("businfo") == bus_info)
+        port = next((port for port in self._lshw_net_info if port.get("businfo") == bus_info), None)
         if port is None:
             raise ConfigurationError(f"Port {pci_address} could not be found on the node.")
 
-- 
2.53.0


             reply	other threads:[~2026-04-22 18:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-22 18:35 Riley Fletcher [this message]
2026-04-23 13:10 ` [PATCH v2] dts: fix port info getter when port is not found Luca Vizzarro

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=20260422183524.2012369-1-rileyf@linux.ibm.com \
    --to=rileyf@linux.ibm.com \
    --cc=Luca.Vizzarro@arm.com \
    --cc=dev@dpdk.org \
    --cc=patrickrobb1997@gmail.com \
    --cc=stable@dpdk.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