All of lore.kernel.org
 help / color / mirror / Atom feed
* [Intel-gfx] [PATCH] ALSA: hda/i915: Fix one too many pci_dev_put()
@ 2022-04-16  6:44 ` Lucas De Marchi
  0 siblings, 0 replies; 19+ messages in thread
From: Lucas De Marchi @ 2022-04-16  6:44 UTC (permalink / raw)
  To: intel-gfx, alsa-devel; +Cc: Takashi Iwai, Lucas De Marchi

pci_get_class() will already unref the pci device passed as argument.
So if it's unconditionally unref'ed, even if the loop is not stopped,
there will be one too many unref for each device not matched.

Cc: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Cc: Takashi Iwai <tiwai@suse.de>
Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/5701
Fixes: 0dc2696a4623 ("ALSA: hda/i915 - skip acomp init if no matching display")
Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
---
 sound/hda/hdac_i915.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/sound/hda/hdac_i915.c b/sound/hda/hdac_i915.c
index 1ce2cea137db..12dad5e9c45d 100644
--- a/sound/hda/hdac_i915.c
+++ b/sound/hda/hdac_i915.c
@@ -127,11 +127,10 @@ static int i915_gfx_present(struct pci_dev *hdac_pci)
 		display_dev = pci_get_class(class, display_dev);
 
 		if (display_dev && display_dev->vendor == PCI_VENDOR_ID_INTEL &&
-		    connectivity_check(display_dev, hdac_pci))
+		    connectivity_check(display_dev, hdac_pci)) {
+			pci_dev_put(display_dev);
 			match = true;
-
-		pci_dev_put(display_dev);
-
+		}
 	} while (!match && display_dev);
 
 	return match;
-- 
2.35.2


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

end of thread, other threads:[~2022-04-19 15:08 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-16  6:44 [Intel-gfx] [PATCH] ALSA: hda/i915: Fix one too many pci_dev_put() Lucas De Marchi
2022-04-16  6:44 ` Lucas De Marchi
2022-04-16  7:33 ` [Intel-gfx] ✓ Fi.CI.BAT: success for " Patchwork
2022-04-16  8:57 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " Patchwork
2022-04-17 10:13 ` [Intel-gfx] [PATCH] " Kai Vehmanen
2022-04-17 10:13   ` Kai Vehmanen
2022-04-18  4:50   ` [Intel-gfx] " Lucas De Marchi
2022-04-19  5:54     ` Takashi Iwai
2022-04-19  5:54       ` Takashi Iwai
2022-04-19  6:26       ` Lucas De Marchi
2022-04-19  6:26         ` Lucas De Marchi
2022-04-19  6:40         ` Takashi Iwai
2022-04-19  6:40           ` Takashi Iwai
2022-04-19  6:56           ` Takashi Iwai
2022-04-19  6:56             ` Takashi Iwai
2022-04-19  7:01 ` Takashi Iwai
2022-04-19  7:01   ` Takashi Iwai
2022-04-19 15:05   ` Lucas De Marchi
2022-04-19 15:05     ` [Intel-gfx] " Lucas De Marchi

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.