Skip to contentSkip to conversation

ice1712: check if snd card loaded, if not do not proceed

PATCH In review Konstantinos Tsimpoukas 2 participants 4 messages Jul 11, 2014 – Jul 14, 2014 Sound

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ice1712: check if snd card loaded, if not do not proceed

Just adding a simple if statement, which
verifies if actually card is loaded, if not
does not continue with the execution
of the snd_card_free.

---
 sound/pci/ice1712/ice1712.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
sound/pci/ice1712/ice1712.c +2 -1
index d9b9e45..431096b 100644
@@ -2819,7 +2819,8 @@ static void snd_ice1712_remove(struct pci_dev *pci)
 
 	if (ice->card_info && ice->card_info->chip_exit)
 		ice->card_info->chip_exit(ice);
-	snd_card_free(card);
+	if (card)
+		snd_card_free(card);
 }
 
 #ifdef CONFIG_PM_SLEEP
Signature · 1 line
1.9.1
#1 lore raw

At Thu, 10 Jul 2014 23:19:37 -0500,

Quoted 5 lines · Konstantinos Tsimpoukas

Just adding a simple if statement, which
verifies if actually card is loaded, if not
does not continue with the execution
of the snd_card_free.

It's already referenced by ice, so a NULL check must be peformed at first. But, basically card is always non-NULL. The remove callback is called only for objects that was properly bound with probe callback. snd_ice1712_probe() always sets the card pointer when it succeeds.

thanks,

Takashi

Quoted 22 lines
---
 sound/pci/ice1712/ice1712.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
sound/pci/ice1712/ice1712.c +2 -1
index d9b9e45..431096b 100644
@@ -2819,7 +2819,8 @@ static void snd_ice1712_remove(struct pci_dev *pci)
 
 	if (ice->card_info && ice->card_info->chip_exit)
 		ice->card_info->chip_exit(ice);
-	snd_card_free(card);
+	if (card)
+		snd_card_free(card);
 }
 
 #ifdef CONFIG_PM_SLEEP
Signature · 1 line
1.9.1
#2 lore raw

Then i suppose the same applies for hda snd remove (in hda_intel.c), as same struct is used there as well.

Regards,
Kostas

2014-07-11 5:06 GMT-05:00 Takashi Iwai <[email protected]>:

Quoted 43 lines

At Thu, 10 Jul 2014 23:19:37 -0500,

Quoted 5 lines · Konstantinos Tsimpoukas

Just adding a simple if statement, which
verifies if actually card is loaded, if not
does not continue with the execution
of the snd_card_free.

It's already referenced by ice, so a NULL check must be peformed at first. But, basically card is always non-NULL. The remove callback is called only for objects that was properly bound with probe callback. snd_ice1712_probe() always sets the card pointer when it succeeds.

thanks,

Takashi

Quoted 22 lines
---
 sound/pci/ice1712/ice1712.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
sound/pci/ice1712/ice1712.c +2 -2
index d9b9e45..431096b 100644
@@ -2819,7 +2819,8 @@ static void snd_ice1712_remove(struct pci_dev *pci)
 
      if (ice->card_info && ice->card_info->chip_exit)
              ice->card_info->chip_exit(ice);
-     snd_card_free(card);
+     if (card)
+             snd_card_free(card);
 }
 
 #ifdef CONFIG_PM_SLEEP
--

1.9.1

#3 lore raw

At Fri, 11 Jul 2014 12:50:10 -0500,

Quoted 3 lines · Konstantinos Tsimpoukas

Then i suppose the same applies for hda snd remove (in hda_intel.c), as same struct is used there as well.

No, hda_intel.c is an exception. Its probe continues to a workqueue, and the probe failure might happen asynchronously, thus pci drvdata can be actually NULL at remove callback.

Takashi

Quoted 52 lines

Regards,
Kostas

2014-07-11 5:06 GMT-05:00 Takashi Iwai <[email protected]>:

Quoted 38 lines

At Thu, 10 Jul 2014 23:19:37 -0500,

Quoted 5 lines · Konstantinos Tsimpoukas

Just adding a simple if statement, which
verifies if actually card is loaded, if not
does not continue with the execution
of the snd_card_free.

It's already referenced by ice, so a NULL check must be peformed at first. But, basically card is always non-NULL. The remove callback is called only for objects that was properly bound with probe callback. snd_ice1712_probe() always sets the card pointer when it succeeds.

thanks,

Takashi

Quoted 18 lines
---
 sound/pci/ice1712/ice1712.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
sound/pci/ice1712/ice1712.c +2 -1
index d9b9e45..431096b 100644
@@ -2819,7 +2819,8 @@ static void snd_ice1712_remove(struct pci_dev *pci)
 
      if (ice->card_info && ice->card_info->chip_exit)
              ice->card_info->chip_exit(ice);
-     snd_card_free(card);
+     if (card)
+             snd_card_free(card);
 }
 
Quoted 5 lines
Quoted 4 lines
sound/pci/ice1712/ice1712.c +0 -1
 #ifdef CONFIG_PM_SLEEP
--

1.9.1

[2 <text/html; UTF-8 (quoted-printable)>]