From: Takashi Iwai Date: Mon, 24 Oct 2005 16:16:50 +0000 (+0200) Subject: [PATCH] ALSA: Fix Oops of suspend/resume with generic drivers X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=d5c5d8fe32a4b9b14363c6031061e98e26da59a2;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git [PATCH] ALSA: Fix Oops of suspend/resume with generic drivers The patch fixes Oops from sound drivers using generic platform device but have no suspend/resume callbacks. Signed-off-by: Takashi Iwai Signed-off-by: Linus Torvalds --- diff --git a/sound/core/init.c b/sound/core/init.c index a5702014a704..c72a79115cca 100644 --- a/sound/core/init.c +++ b/sound/core/init.c @@ -828,7 +828,8 @@ static int snd_generic_suspend(struct device *dev, pm_message_t state, u32 level card = get_snd_generic_card(dev); if (card->power_state == SNDRV_CTL_POWER_D3hot) return 0; - card->pm_suspend(card, PMSG_SUSPEND); + if (card->pm_suspend) + card->pm_suspend(card, PMSG_SUSPEND); snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); return 0; } @@ -843,7 +844,8 @@ static int snd_generic_resume(struct device *dev, u32 level) card = get_snd_generic_card(dev); if (card->power_state == SNDRV_CTL_POWER_D0) return 0; - card->pm_resume(card); + if (card->pm_suspend) + card->pm_resume(card); snd_power_change_state(card, SNDRV_CTL_POWER_D0); return 0; }