[PATCH] ALSA: hda: Fix PCI connectivity check for parent buses
From: Sreeraj S Kurup
Date: Sat Dec 05 2026 - 06:44:39 EST
The connectivity_check() function checks whether the i915 GPU and
HD-audio controller are connected through the same PCI bus.
When checking their parent buses, both parent pointers can be NULL
if the devices are on different PCI root buses.
The current code compares these pointers before checking for NULL.
Since two NULL pointers are equal, the function incorrectly reports
that the devices are connected.
Move the NULL check before the parent bus comparison to prevent
this false positive.
Signed-off-by: Sreeraj S Kurup <sreekuttan2156239@xxxxxxxxx>
---
sound/hda/core/i915.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/sound/hda/core/i915.c b/sound/hda/core/i915.c
index 6c068b135b7d..1eed61ce65df 100644
--- a/sound/hda/core/i915.c
+++ b/sound/hda/core/i915.c
@@ -85,12 +85,12 @@ static bool connectivity_check(struct pci_dev *i915, struct pci_dev *hdac)
bus_b = bus_b->parent;
/* connected via parent bus (may be NULL!) */
- if (bus_a == bus_b)
- return true;
-
if (!bus_a || !bus_b)
return false;
+ if (bus_a == bus_b)
+ return true;
+
/*
* on i915 discrete GPUs with embedded HDA audio, the two
* devices are connected via 2nd level PCI bridge
--
2.55.0