From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 00549606A322 for ; Sat, 5 Dec 2026 01:02:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=KZqqtifr Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BB94D10E8C4; Sat, 5 Dec 2026 01:02:39 +0000 (UTC) Received: from tor.source.kernel.org (tor.source.kernel.org [172.105.4.254]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6B9F910E805; Sat, 5 Dec 2026 01:02:33 +0000 (UTC) Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id AC46060218; Sat, 5 Dec 2026 01:02:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3556D1F0092B; Sat, 5 Dec 2026 01:02:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796432552; bh=4ZWBwYQy1gCzv9RFEdFlUjZY0rtMEHnhp4/gf2TZyBc=; h=From:Subject:Reply-To:To:In-Reply-To:References:Date; b=KZqqtifravfMKxd5z0E9oCjiUv5b0sCKFncJagXF7hJxaNhiTCnARebVnauM9XStu KGo8bTDCEA0qiVIfCA9TLFjEcn5Vi2JqZbtxyPkuxnFUjEXfQUoeKgyIeSXT0C3wCC oZ9zAdTiev+mzZXV8e9PrnJ/qDho2Oun4wG31MpPP09TMn/H0jKQlgFn4qWBqiBeJF V6mpbYj7ROUhrY07vgWa1DvMVz/jnEwWETQ924KmhcRlPDLgZ6UJUndB2zpwCmT5jR fHaOouyxcjKH13Wo9MuO+sq/fOLmbFkIwWqecHGkMPOIP38NWnXFPFOBVASuGWjOrf HfY+PoSk+DKWw== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v2 14/16] PCI: Add iterators for devices and resources in bus windows To: =?utf-8?b?SWxwbyBKw6RydmluZW4=?= , dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org, linux-pci@vger.kernel.org In-Reply-To: <20261205003957.3304-15-ilpo.jarvinen@linux.intel.com> References: <20261205003957.3304-1-ilpo.jarvinen@linux.intel.com> <20261205003957.3304-15-ilpo.jarvinen@linux.intel.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Sat, 05 Dec 2026 01:02:31 +0000 X-BeenThere: intel-xe@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Xe graphics driver List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: sashiko-reviews@lists.linux.dev Sender: "Intel-xe" X-Spam-Status: No, score=-11.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 X-Archived-By: Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Low] PCI: break inside pci_bus_for_each_window_resource() only exits inner loop -- commit 73da7b0150edfd796b5aa15f8d77912a014f57a3 Author: Ilpo J=C3=A4rvinen PCI: Add iterators for devices and resources in bus windows This commit adds pci_bus_for_each_window_dev() and pci_bus_for_each_window_resource() to iterate over devices on a bus (and below its transparent bridges) and their resources that reside directly in a given bus window. > diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h > index 77efa4c5c960e..9d0cbe6c89917 100644 > --- a/drivers/pci/pci.h > +++ b/drivers/pci/pci.h [ ... ] > @@ -546,6 +547,27 @@ bool pci_bus_clip_resource(struct pci_dev *dev, int = idx); > void pci_walk_bus_locked(struct pci_bus *top, > int (*cb)(struct pci_dev *, void *), > void *userdata); > +struct pci_dev *pci_bus_next_window_dev(struct pci_bus *bus, > + struct pci_dev *dev); > + > +/* > + * Iterate over the devices whose resources may reside directly in the > + * windows of @bus: the devices on @bus and, recursively, the devices > + * below its transparent bridges. A transparent bridge also forwards > + * accesses outside of its own windows. > + */ > +#define pci_bus_for_each_window_dev(bus, dev) \ > + for (dev =3D pci_bus_next_window_dev(bus, NULL); dev; \ > + dev =3D pci_bus_next_window_dev(bus, dev)) > + > +/* > + * Iterate over the resources of the devices of > + * pci_bus_for_each_window_dev() that reside directly in window @win. > + */ > +#define pci_bus_for_each_window_resource(bus, win, dev, res) \ > + pci_bus_for_each_window_dev(bus, dev) \ > + pci_dev_for_each_resource(dev, res) \ > + for_each_if((res)->parent =3D=3D (win)) [Severity: Low] Will a break statement inside pci_bus_for_each_window_resource() only exit the inner pci_dev_for_each_resource() loop? Because this macro nests two separate for loops, break only stops scanning the current device's resources while the outer pci_bus_for_each_window_dev() loop silently continues to the remaining devices, executing the loop body again and overwriting dev and res. Backing the iterator with a single-loop helper that finds the next matching resource, or documenting that break is unsupported, would avoid this trap. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261205003957.3304= -1-ilpo.jarvinen@linux.intel.com?part=3D14