mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sreeraj S Kurup <sreekuttan2156239@gmail.com>
To: tiwai@suse.de, perex@perex.cz
Cc: linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org,
	Sreeraj S Kurup <sreekuttan2156239@gmail.com>
Subject: [PATCH] ALSA: hda: Fix PCI connectivity check for parent buses
Date: Sat,  5 Dec 2026 11:43:49 +0000	[thread overview]
Message-ID: <20261205114349.4074-1-sreekuttan2156239@gmail.com> (raw)

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


             reply	other threads:[~2026-12-05 11:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-05 11:43 Sreeraj S Kurup [this message]
2026-12-05 12:16 ` Sreeraj S Kurup

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261205114349.4074-1-sreekuttan2156239@gmail.com \
    --to=sreekuttan2156239@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®