[PATCH libpciaccess] PCI: set correct mask value when matching for bridges.

Mark Kettenis mark.kettenis at xs4all.nl
Wed Sep 7 08:05:58 PDT 2011


> From: Egbert Eich <eich at freedesktop.org>
> Date: Wed,  7 Sep 2011 16:44:48 +0200
> 
> The mask must not be zero otherwise the matching condition will never
> be true: ((val & mask) == set).

> ---
>  src/common_bridge.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/src/common_bridge.c b/src/common_bridge.c
> index 871c1f6..aea9435 100644
> --- a/src/common_bridge.c
> +++ b/src/common_bridge.c
> @@ -328,7 +328,7 @@ pci_device_get_parent_bridge(struct pci_device *dev)
>      struct pci_id_match bridge_match = {
>          PCI_MATCH_ANY, PCI_MATCH_ANY, PCI_MATCH_ANY, PCI_MATCH_ANY,
>          (PCI_CLASS_BRIDGE << 16) | (PCI_SUBCLASS_BRIDGE_PCI << 8),
> -        0
> +        (PCI_CLASS_BRIDGE << 16) | (PCI_SUBCLASS_BRIDGE_PCI << 8)

Shouldn't that be:

-         0
+         (0xff << 16) | (0xff << 8)

Unless I'm mistaken with your diff it will spuriously match stuff that
isn't a PCI bridge either.


More information about the xorg-devel mailing list