* [PATCH] ALSA: hda/i915: Fix one too many pci_dev_put()
@ 2022-04-16 6:44 Lucas De Marchi
2022-04-17 10:13 ` Kai Vehmanen
2022-04-19 7:01 ` Takashi Iwai
0 siblings, 2 replies; 9+ 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, Kai Vehmanen
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] 9+ messages in thread* Re: [PATCH] ALSA: hda/i915: Fix one too many pci_dev_put() 2022-04-16 6:44 [PATCH] ALSA: hda/i915: Fix one too many pci_dev_put() Lucas De Marchi @ 2022-04-17 10:13 ` Kai Vehmanen 2022-04-18 4:50 ` [Intel-gfx] " Lucas De Marchi 2022-04-19 7:01 ` Takashi Iwai 1 sibling, 1 reply; 9+ messages in thread From: Kai Vehmanen @ 2022-04-17 10:13 UTC (permalink / raw) To: Lucas De Marchi; +Cc: Takashi Iwai, intel-gfx, alsa-devel, Kai Vehmanen 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@linux.intel.com> Br, Kai ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Intel-gfx] [PATCH] ALSA: hda/i915: Fix one too many pci_dev_put() 2022-04-17 10:13 ` Kai Vehmanen @ 2022-04-18 4:50 ` Lucas De Marchi 2022-04-19 5:54 ` Takashi Iwai 0 siblings, 1 reply; 9+ messages in thread From: Lucas De Marchi @ 2022-04-18 4:50 UTC (permalink / raw) To: Kai Vehmanen; +Cc: Takashi Iwai, intel-gfx, alsa-devel On Sun, Apr 17, 2022 at 01:13:49PM +0300, Kai Vehmanen wrote: >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@linux.intel.com> I applied this to our topic/core-for-CI branch to unblock CI on DG2. Ultimately the target for this is the sound tree though. thanks Lucas De Marchi > >Br, Kai ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Intel-gfx] [PATCH] ALSA: hda/i915: Fix one too many pci_dev_put() 2022-04-18 4:50 ` [Intel-gfx] " Lucas De Marchi @ 2022-04-19 5:54 ` Takashi Iwai 2022-04-19 6:26 ` Lucas De Marchi 0 siblings, 1 reply; 9+ messages in thread From: Takashi Iwai @ 2022-04-19 5:54 UTC (permalink / raw) To: Lucas De Marchi; +Cc: intel-gfx, alsa-devel, Kai Vehmanen On Mon, 18 Apr 2022 06:50:32 +0200, Lucas De Marchi wrote: > > On Sun, Apr 17, 2022 at 01:13:49PM +0300, Kai Vehmanen wrote: > >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@linux.intel.com> > > I applied this to our topic/core-for-CI branch to unblock CI on > DG2. Ultimately the target for this is the sound tree though. The patch looks good, feel free to submit it. thanks, Takashi ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Intel-gfx] [PATCH] ALSA: hda/i915: Fix one too many pci_dev_put() 2022-04-19 5:54 ` Takashi Iwai @ 2022-04-19 6:26 ` Lucas De Marchi 2022-04-19 6:40 ` Takashi Iwai 0 siblings, 1 reply; 9+ messages in thread From: Lucas De Marchi @ 2022-04-19 6:26 UTC (permalink / raw) To: Takashi Iwai; +Cc: intel-gfx, alsa-devel, Kai Vehmanen On Tue, Apr 19, 2022 at 07:54:30AM +0200, Takashi Iwai wrote: >On Mon, 18 Apr 2022 06:50:32 +0200, >Lucas De Marchi wrote: >> >> On Sun, Apr 17, 2022 at 01:13:49PM +0300, Kai Vehmanen wrote: >> >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@linux.intel.com> >> >> I applied this to our topic/core-for-CI branch to unblock CI on >> DG2. Ultimately the target for this is the sound tree though. > >The patch looks good, feel free to submit it. not sure if I was clear. This patch is already targeting the sound tree: it should apply cleanly. topic/core-for-CI in the drm subsystem is a "temporary branch" while we don't backmerge with the sound changes. Lucas De Marchi > > >thanks, > >Takashi ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Intel-gfx] [PATCH] ALSA: hda/i915: Fix one too many pci_dev_put() 2022-04-19 6:26 ` Lucas De Marchi @ 2022-04-19 6:40 ` Takashi Iwai 2022-04-19 6:56 ` Takashi Iwai 0 siblings, 1 reply; 9+ messages in thread From: Takashi Iwai @ 2022-04-19 6:40 UTC (permalink / raw) To: Lucas De Marchi; +Cc: intel-gfx, alsa-devel, Kai Vehmanen On Tue, 19 Apr 2022 08:26:06 +0200, Lucas De Marchi wrote: > > On Tue, Apr 19, 2022 at 07:54:30AM +0200, Takashi Iwai wrote: > >On Mon, 18 Apr 2022 06:50:32 +0200, > >Lucas De Marchi wrote: > >> > >> On Sun, Apr 17, 2022 at 01:13:49PM +0300, Kai Vehmanen wrote: > >> >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@linux.intel.com> > >> > >> I applied this to our topic/core-for-CI branch to unblock CI on > >> DG2. Ultimately the target for this is the sound tree though. > > > >The patch looks good, feel free to submit it. > > not sure if I was clear. This patch is already targeting the sound tree: > it should apply cleanly. The original patch hasn't reached to me (we've had the mail server problem in the last weekend, and that might be the reason). Could you resubmit? thanks, Takashi ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Intel-gfx] [PATCH] ALSA: hda/i915: Fix one too many pci_dev_put() 2022-04-19 6:40 ` Takashi Iwai @ 2022-04-19 6:56 ` Takashi Iwai 0 siblings, 0 replies; 9+ messages in thread From: Takashi Iwai @ 2022-04-19 6:56 UTC (permalink / raw) To: Lucas De Marchi; +Cc: intel-gfx, alsa-devel, Kai Vehmanen On Tue, 19 Apr 2022 08:40:01 +0200, Takashi Iwai wrote: > > On Tue, 19 Apr 2022 08:26:06 +0200, > Lucas De Marchi wrote: > > > > On Tue, Apr 19, 2022 at 07:54:30AM +0200, Takashi Iwai wrote: > > >On Mon, 18 Apr 2022 06:50:32 +0200, > > >Lucas De Marchi wrote: > > >> > > >> On Sun, Apr 17, 2022 at 01:13:49PM +0300, Kai Vehmanen wrote: > > >> >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@linux.intel.com> > > >> > > >> I applied this to our topic/core-for-CI branch to unblock CI on > > >> DG2. Ultimately the target for this is the sound tree though. > > > > > >The patch looks good, feel free to submit it. > > > > not sure if I was clear. This patch is already targeting the sound tree: > > it should apply cleanly. > > The original patch hasn't reached to me (we've had the mail server > problem in the last weekend, and that might be the reason). > > Could you resubmit? Never mind, I could find it in lore. https://lore.kernel.org/all/20220416064418.2364582-1-lucas.demarchi@intel.com/ Takashi ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] ALSA: hda/i915: Fix one too many pci_dev_put() 2022-04-16 6:44 [PATCH] ALSA: hda/i915: Fix one too many pci_dev_put() Lucas De Marchi 2022-04-17 10:13 ` Kai Vehmanen @ 2022-04-19 7:01 ` Takashi Iwai 2022-04-19 15:05 ` Lucas De Marchi 1 sibling, 1 reply; 9+ messages in thread From: Takashi Iwai @ 2022-04-19 7:01 UTC (permalink / raw) To: Lucas De Marchi; +Cc: intel-gfx, alsa-devel, Kai Vehmanen On Sat, 16 Apr 2022 08:44:18 +0200, 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, > 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> Thanks, applied now. But the Fixes commit id was wrong. I corrected to the right upstream one, c9db8a30d9f0. Takashi ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] ALSA: hda/i915: Fix one too many pci_dev_put() 2022-04-19 7:01 ` Takashi Iwai @ 2022-04-19 15:05 ` Lucas De Marchi 0 siblings, 0 replies; 9+ messages in thread From: Lucas De Marchi @ 2022-04-19 15:05 UTC (permalink / raw) To: Takashi Iwai; +Cc: intel-gfx, alsa-devel, Kai Vehmanen On Tue, Apr 19, 2022 at 09:01:34AM +0200, Takashi Iwai wrote: >On Sat, 16 Apr 2022 08:44:18 +0200, >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, >> 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> > >Thanks, applied now. >But the Fixes commit id was wrong. I corrected to the right upstream >one, c9db8a30d9f0. indeed, I messed that up, using the hash from our local tree. thanks Lucas De Marchi ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2022-04-19 15:08 UTC | newest] Thread overview: 9+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2022-04-16 6:44 [PATCH] ALSA: hda/i915: Fix one too many pci_dev_put() Lucas De Marchi 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 6:26 ` Lucas De Marchi 2022-04-19 6:40 ` Takashi Iwai 2022-04-19 6:56 ` Takashi Iwai 2022-04-19 7:01 ` Takashi Iwai 2022-04-19 15:05 ` Lucas De Marchi
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox