Hi,

Here are my conclusion from a closer look.

On Friday, 23 January 2026 15:34:23 CET Janusz Krzysztofik wrote:
> Hi Sebastian,
> 
> On Friday, 23 January 2026 12:03:45 CET Sebastian Brzezinka wrote:
> > Hi Janusz,
> > 
> > On Wed Jan 21, 2026 at 12:42 PM CET, Janusz Krzysztofik wrote:
> > > In a short listing, information about PCI parents of DRM devices, as well
> > > as about DRM children of PCI GPU devices is now printed.  In a long
> > > listing in turn, the latter is also printed.  Apply a similar approach to
> > > PCIe bridge upstream ports: print information about their PCI GPU children
> > > and also their codenames in both formats, and inform about upstream ports
> > > of PCIe bridges found on PCI discrete GPU cards in the short format.
> > >
> > > Signed-off-by: Janusz Krzysztofik <[email protected]>
> > > ---
> > >  lib/igt_device_scan.c | 22 +++++++++++++++++-----
> > >  1 file changed, 17 insertions(+), 5 deletions(-)
> > >
> > > diff --git a/lib/igt_device_scan.c b/lib/igt_device_scan.c
> > > index e86da001a9..69ea8d2eaf 100644
> > > --- a/lib/igt_device_scan.c
> > > +++ b/lib/igt_device_scan.c
> > > @@ -250,6 +250,8 @@ struct igt_device {
> > >   char *codename; /* For grouping by codename */
> > >   enum dev_type dev_type; /* For grouping by integrated/discrete */
> > >  
> > > + char *pci_gpu; /* Filled for upstream bridge ports */
> > > +
> > >   struct igt_list_head link;
> > >  };
> > >  
> > > @@ -1058,6 +1060,9 @@ static void update_or_add_parent(struct udev *udev,
> > >   igt_assert(bridge_idev);
> > >  
> > >   bridge_idev->dev_type = DEVTYPE_BRIDGE;
> > > + bridge_idev->pci_gpu = parent_idev->pci_slot_name;
> > > + bridge_idev->codename = parent_idev->codename;
> > > + parent_idev->parent = bridge_idev;
> > I haven’t checked the release process myself. Have you verified that 
> > freeing this
> > memory won’t lead to any problems?
> >  (Maybe use strdup??)
> 
> Indeed, I might have missed something here.  While pci_gpu and parent seem 
> safe for me at a first glance, I'm not sure about codename.  Let me have 
> another, closer look at all of them.

I think parent_idev->parent is safe, it follows the pattern used before:
        idev->parent = parent_idev;

However, bridge_idev->codename evidently requires strdup() to avoid double 
free() on destroy.

As long as printing to stdout likely captures content of bridge_idev->pci_gpu 
before parent_idev and its attributes are destroyed, that one seems safe, but 
let's use strdup() as well to be on the safe side.

Thanks for catching this.

Thanks,
Janusz


> 
> Thanks,
> Janusz
> 




Reply via email to