public inbox for linux-sound@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] ice1712: check if snd card loaded, if not do not proceed
@ 2014-07-11  4:19 Konstantinos Tsimpoukas
  2014-07-11 10:06 ` Takashi Iwai
  0 siblings, 1 reply; 3+ messages in thread
From: Konstantinos Tsimpoukas @ 2014-07-11  4:19 UTC (permalink / raw)
  To: Konstantinos Tsimpoukas, alsa-devel
  Cc: Jaroslav Kysela, Takashi Iwai, linux-sound, linux-kernel

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.

Signed-off-by: Konstantinos Tsimpoukas <kostaslinuxxx@gmail.com>
---
 sound/pci/ice1712/ice1712.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sound/pci/ice1712/ice1712.c b/sound/pci/ice1712/ice1712.c
index d9b9e45..431096b 100644
--- a/sound/pci/ice1712/ice1712.c
+++ b/sound/pci/ice1712/ice1712.c
@@ -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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/1] ice1712: check if snd card loaded, if not do not proceed
  2014-07-11  4:19 [PATCH 1/1] ice1712: check if snd card loaded, if not do not proceed Konstantinos Tsimpoukas
@ 2014-07-11 10:06 ` Takashi Iwai
       [not found]   ` <CAKs1uqwYkz6OA4si8dsRicVg-tn530QhJAhacmaW1e74REQQdA@mail.gmail.com>
  0 siblings, 1 reply; 3+ messages in thread
From: Takashi Iwai @ 2014-07-11 10:06 UTC (permalink / raw)
  To: Konstantinos Tsimpoukas
  Cc: alsa-devel, Jaroslav Kysela, linux-sound, linux-kernel

At Thu, 10 Jul 2014 23:19:37 -0500,
Konstantinos Tsimpoukas wrote:
> 
> 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


> Signed-off-by: Konstantinos Tsimpoukas <kostaslinuxxx@gmail.com>
> ---
>  sound/pci/ice1712/ice1712.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/sound/pci/ice1712/ice1712.c b/sound/pci/ice1712/ice1712.c
> index d9b9e45..431096b 100644
> --- a/sound/pci/ice1712/ice1712.c
> +++ b/sound/pci/ice1712/ice1712.c
> @@ -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
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/1] ice1712: check if snd card loaded, if not do not proceed
       [not found]   ` <CAKs1uqwYkz6OA4si8dsRicVg-tn530QhJAhacmaW1e74REQQdA@mail.gmail.com>
@ 2014-07-14  8:59     ` Takashi Iwai
  0 siblings, 0 replies; 3+ messages in thread
From: Takashi Iwai @ 2014-07-14  8:59 UTC (permalink / raw)
  To: Konstantinos Tsimpoukas
  Cc: alsa-devel, Jaroslav Kysela, linux-sound, linux-kernel

At Fri, 11 Jul 2014 12:50:10 -0500,
Konstantinos Tsimpoukas wrote:
> 
> 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

> 
> Regards,
> Kostas
> 
> 
> 2014-07-11 5:06 GMT-05:00 Takashi Iwai <tiwai@suse.de>:
> 
> > At Thu, 10 Jul 2014 23:19:37 -0500,
> > Konstantinos Tsimpoukas wrote:
> > >
> > > 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
> >
> >
> > > Signed-off-by: Konstantinos Tsimpoukas <kostaslinuxxx@gmail.com>
> > > ---
> > >  sound/pci/ice1712/ice1712.c | 3 ++-
> > >  1 file changed, 2 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/sound/pci/ice1712/ice1712.c b/sound/pci/ice1712/ice1712.c
> > > index d9b9e45..431096b 100644
> > > --- a/sound/pci/ice1712/ice1712.c
> > > +++ b/sound/pci/ice1712/ice1712.c
> > > @@ -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
> > >
> >
> [2  <text/html; UTF-8 (quoted-printable)>]
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-07-14  8:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-11  4:19 [PATCH 1/1] ice1712: check if snd card loaded, if not do not proceed Konstantinos Tsimpoukas
2014-07-11 10:06 ` Takashi Iwai
     [not found]   ` <CAKs1uqwYkz6OA4si8dsRicVg-tn530QhJAhacmaW1e74REQQdA@mail.gmail.com>
2014-07-14  8:59     ` Takashi Iwai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox