[Intel-gfx] [PATCH] ALSA: hda/i915: Fix one too many pci_dev_put()

Kai Vehmanen kai.vehmanen at linux.intel.com
Sun Apr 17 10:13:49 UTC 2022


Hi,

On Fri, 15 Apr 2022, Lucas De Marchi wrote:

> 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,

thanks Lucas. And yes indeed, overlooked that pci_get_class() 
will decrement the from device is specified.

> --- 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);
> -
> +		}

Reviewed-by: Kai Vehmanen <kai.vehmanen at linux.intel.com>

Br, Kai


More information about the Intel-gfx mailing list