All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cezary Rojewski <cezary.rojewski@intel.com>
To: Mark Brown <broonie@kernel.org>
Cc: <tiwai@suse.com>, <perex@perex.cz>,
	<amadeuszx.slawinski@linux.intel.com>,
	<linux-sound@vger.kernel.org>
Subject: Re: [PATCH 1/2] ASoC: Intel: avs: Synchronize happy and error paths in PCI probe
Date: Tue, 29 Jul 2025 14:49:18 +0200	[thread overview]
Message-ID: <179e32a8-b20b-40ab-8663-2a793a96993b@intel.com> (raw)
In-Reply-To: <9af2c2ca-103f-4f2e-afab-1fea5a2160a5@sirena.org.uk>

On 2025-07-29 1:47 PM, Mark Brown wrote:
> On Tue, Jul 29, 2025 at 01:42:28PM +0200, Cezary Rojewski wrote:
> 
>>   err_i915_init:
>> -	pci_free_irq(pci, 0, adev);
>> -	pci_free_irq(pci, 0, bus);
>> -	pci_free_irq_vectors(pci);
>> -	pci_clear_master(pci);
>>   	pci_set_drvdata(pci, NULL);
>> +	pci_clear_master(pci);
>> +	pci_free_irq(pci, 0, adev);
>> +	pci_free_irq(pci, 0, bus);
>> +	pci_free_irq_vectors(pci);
> 
> The ordering before clearing the driver data actually looks sensible
> there, though looking at the interrupt handlers quickly they don't seem
> to pay attention to driver data.  Really you could just delete the
> pci_set_drvdata(), it should be redundant (and IIRC the driver core does
> that anyway).

While I do agree that pci_set_drvdata(NULL) could be skipped, I feel 
better with having a true reverse order in the error path:

happy path:
	pci_alloc_irq_vectors();
	pci_request_irq(bus);
	pci_request_irq(adev);
	pci_set_master();


error path:
	pci_clear_master(pci);
	pci_free_irq(pci, 0, adev);
	pci_free_irq(pci, 0, bus);
	pci_free_irq_vectors(pci);

Is there anything wrong with the approach before I send v2?

  reply	other threads:[~2025-07-29 12:49 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-29 11:42 [PATCH 0/2] ASoC: Intel: avs: Fixes for avs_pci_probe() Cezary Rojewski
2025-07-29 11:42 ` [PATCH 1/2] ASoC: Intel: avs: Synchronize happy and error paths in PCI probe Cezary Rojewski
2025-07-29 11:47   ` Mark Brown
2025-07-29 12:49     ` Cezary Rojewski [this message]
2025-07-29 13:32       ` Mark Brown
2025-07-30 12:32         ` Cezary Rojewski
2025-07-29 11:42 ` [PATCH 2/2] ASoC: Intel: avs: Fix uninitialized pointer error in probe() Cezary Rojewski

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=179e32a8-b20b-40ab-8663-2a793a96993b@intel.com \
    --to=cezary.rojewski@intel.com \
    --cc=amadeuszx.slawinski@linux.intel.com \
    --cc=broonie@kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.com \
    /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 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.