All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ALSA: hda: Fix PCI connectivity check for parent buses
@ 2026-12-05 11:43 Sreeraj S Kurup
  2026-12-05 11:51 ` sashiko-bot
  2026-12-05 12:16 ` Sreeraj S Kurup
  0 siblings, 2 replies; 3+ messages in thread
From: Sreeraj S Kurup @ 2026-12-05 11:43 UTC (permalink / raw)
  To: tiwai, perex; +Cc: linux-sound, linux-kernel, Sreeraj S Kurup

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@gmail.com>
---
 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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-12-05 12:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-05 11:43 [PATCH] ALSA: hda: Fix PCI connectivity check for parent buses Sreeraj S Kurup
2026-12-05 11:51 ` sashiko-bot
2026-12-05 12:16 ` Sreeraj S Kurup

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.