Re: [PATCH v2] sound/hda: Add NULL check to component match callback function

From: Mika Westerberg
Date: Thu Mar 31 2022 - 12:12:56 EST


Hi,

On Thu, Mar 31, 2022 at 08:33:03AM -0700, Benson Leung wrote:
> > --- a/sound/hda/hdac_i915.c
> > +++ b/sound/hda/hdac_i915.c
> > @@ -102,18 +102,13 @@ static int i915_component_master_match(struct device *dev, int subcomponent,
> > struct pci_dev *hdac_pci, *i915_pci;
> > struct hdac_bus *bus = data;
> >
> > - if (!dev_is_pci(dev))
> > + if (subcomponent != I915_COMPONENT_AUDIO || !dev_is_pci(dev))
> > return 0;
> >
>
> If I recall this bug correctly, it's not the usb port perse that is falling
> through this !dev_is_pci(dev) check, it's actually the usb4-port in a new
> proposed patch by Heikki and Mika to extend the usb type-c component to
> encompass the usb4 specific pieces too. Is it possible usb4 ports are considered
> pci devices, and that's how we got into this situation?

For usb4_port the dev_ic_pci(dev) returns false:

#define dev_is_pci(d) ((d)->bus == &pci_bus_type)

We don't attach them to PCI bus (well they are not PCI devices).