diff mbox series

[v2,1/9] ALSA: hda/intel: Fix error handling in azx_probe()

Message ID 20230719164141.228073-2-maarten.lankhorst@linux.intel.com (mailing list archive)
State Superseded
Headers show
Series sound: Use -EPROBE_DEFER instead of i915 module loading. | expand

Commit Message

Maarten Lankhorst July 19, 2023, 4:41 p.m. UTC
Add missing pci_set_drv to NULL call on error.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
---
 sound/pci/hda/hda_intel.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Peter Ujfalusi July 21, 2023, 11:34 a.m. UTC | #1
On 19/07/2023 19:41, Maarten Lankhorst wrote:
> Add missing pci_set_drv to NULL call on error.
> 
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
> ---
>  sound/pci/hda/hda_intel.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
> index ef831770ca7da..0d2d6bc6c75ef 100644
> --- a/sound/pci/hda/hda_intel.c
> +++ b/sound/pci/hda/hda_intel.c
> @@ -2188,6 +2188,7 @@ static int azx_probe(struct pci_dev *pci,
>  	return 0;
>  
>  out_free:
> +	pci_set_drvdata(pci, NULL);
The original patch added this:
f4c482a4d0b3 ("ALSA: hda - Fix yet another race of vga_switcheroo registration")

but got removed later by:
20a24225d8f9 ("ALSA: PCI: Remove superfluous pci_set_drvdata(pci, NULL) at remove")

and partially added back (to azx_remove) by:
e81478bbe7a1 ("ALSA: hda: fix general protection fault in azx_runtime_idle")

I guess, it should do not harm to add it back...

>  	snd_card_free(card);
>  	return err;
>  }

Reviewed-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Pierre-Louis Bossart July 24, 2023, 10:15 a.m. UTC | #2
On 7/21/23 13:34, Péter Ujfalusi wrote:
> 
> 
> On 19/07/2023 19:41, Maarten Lankhorst wrote:
>> Add missing pci_set_drv to NULL call on error.
>>
>> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
>> ---
>>  sound/pci/hda/hda_intel.c | 1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
>> index ef831770ca7da..0d2d6bc6c75ef 100644
>> --- a/sound/pci/hda/hda_intel.c
>> +++ b/sound/pci/hda/hda_intel.c
>> @@ -2188,6 +2188,7 @@ static int azx_probe(struct pci_dev *pci,
>>  	return 0;
>>  
>>  out_free:
>> +	pci_set_drvdata(pci, NULL);
> The original patch added this:
> f4c482a4d0b3 ("ALSA: hda - Fix yet another race of vga_switcheroo registration")
> 
> but got removed later by:
> 20a24225d8f9 ("ALSA: PCI: Remove superfluous pci_set_drvdata(pci, NULL) at remove")
> 
> and partially added back (to azx_remove) by:
> e81478bbe7a1 ("ALSA: hda: fix general protection fault in azx_runtime_idle")
> 
> I guess, it should do not harm to add it back...
> 
>>  	snd_card_free(card);
>>  	return err;
>>  }
> 
> Reviewed-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>

Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
diff mbox series

Patch

diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index ef831770ca7da..0d2d6bc6c75ef 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -2188,6 +2188,7 @@  static int azx_probe(struct pci_dev *pci,
 	return 0;
 
 out_free:
+	pci_set_drvdata(pci, NULL);
 	snd_card_free(card);
 	return err;
 }