Skip to content

Commit 00fd7cf

Browse files
Lucas De Marchitiwai
authored andcommitted
ALSA: hda/i915: Fix one too many pci_dev_put()
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. Closes: https://gitlab.freedesktop.org/drm/intel/-/issues/5701 Fixes: c9db8a3 ("ALSA: hda/i915 - skip acomp init if no matching display") Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com> Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com> Link: https://lore.kernel.org/r/20220416064418.2364582-1-lucas.demarchi@intel.com Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 parent 6624fb4 commit 00fd7cf

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

sound/hda/hdac_i915.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,11 +127,10 @@ static int i915_gfx_present(struct pci_dev *hdac_pci)
127127
display_dev = pci_get_class(class, display_dev);
128128

129129
if (display_dev && display_dev->vendor == PCI_VENDOR_ID_INTEL &&
130-
connectivity_check(display_dev, hdac_pci))
130+
connectivity_check(display_dev, hdac_pci)) {
131+
pci_dev_put(display_dev);
131132
match = true;
132-
133-
pci_dev_put(display_dev);
134-
133+
}
135134
} while (!match && display_dev);
136135

137136
return match;

0 commit comments

Comments
 (0)