[ALSA] ac97 - NULL check in snd_ac97_suspend/resume
authorTakashi Iwai <tiwai@suse.de>
Thu, 17 Nov 2005 15:00:01 +0000 (16:00 +0100)
committerJaroslav Kysela <perex@suse.cz>
Tue, 3 Jan 2006 11:20:28 +0000 (12:20 +0100)
Modules: AC97 Codec

Add NULL check in snd_ac97_suspend() and snd_ac97_resume() so that
the caller doesn't have to do it by itself.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/pci/ac97/ac97_codec.c

index 9faeaefc8e6e4c0318312d8afc3fefa4b930aa7a..abc83fa85bcd604e27fca56467d3c051e9237954 100644 (file)
@@ -2186,6 +2186,8 @@ static void snd_ac97_powerdown(struct snd_ac97 *ac97)
  */
 void snd_ac97_suspend(struct snd_ac97 *ac97)
 {
+       if (! ac97)
+               return;
        if (ac97->build_ops->suspend)
                ac97->build_ops->suspend(ac97);
        snd_ac97_powerdown(ac97);
@@ -2242,6 +2244,9 @@ void snd_ac97_resume(struct snd_ac97 *ac97)
 {
        unsigned long end_time;
 
+       if (! ac97)
+               return;
+
        if (ac97->bus->ops->reset) {
                ac97->bus->ops->reset(ac97);
                goto  __reset_ready;